qwertyui90
qwertyui90

Reputation: 201

Field not changed when updating table value in asp.net & SQL Server

I created a table named track table and on some user login conditions I inserted initial values on table. Code below

var tracktable = new TrackTable
{
    IPAddress = ipadd,
    LastLoginResult = "Failed",
    LastLoginTime = DateTime.Now,
    LoginAttemptStreak = 1, 
    BlockTime = DateTime.Now,
    IsBlocked= "false"
};
model.InsertTrack(tracktable);

On user's following logins the database is updated with new values for each fields

var tracktable = new TrackTable
{
    IPAddress = Request.ServerVariables["REMOTE_ADDR"],
    LastLoginResult = "Success",
    LastLoginTime = DateTime.Now,
    LoginAttemptStreak = result.LoginAttemptStreak + 1,
    BlockTime = vblocktime, 
    IsBlocked= "true" //not_updating
};
model.Updatetable(ipadd, tracktable);

The problem I am facing comes in update part. In update part the column LastLoginResult is updated to Success. But IsBlocked column has no change - it is still "false". I am totally confused. What might be causing this problem?

Upvotes: 0

Views: 36

Answers (1)

divya
divya

Reputation: 304

you might have missed to pass the value for "IsBlocked" variable in Updatetable() method.

Upvotes: 1

Related Questions