Tuesday, 15 April 2014

vb.net - UPDATE not working when in use with AccessDataSource vb asp.net -


I'm having trouble using the UPDATE command in my ASP.NET project. This project lets the user log in to the page Allows you to log in through a match in the database that matches the username and password for the records and saves the user name as a cookie. I then have a settings page, which I want to allow the user to edit their account details, but when I use the UPDATE function, the query is executed without any errors, but there is no update. Using an AccessDataSource and an UpdateCommand hopefully someone can find a problem with my code and can run me in the right direction. Thanks in advance

  Protected sub page_Load (ByVal as the object, in the form of ByVal E System.EventArgs) the string as sqlcmd sqlcmd = "select first name, secondName, user Name, Date of Birth, UserTable Where Username Password = '' & Amp; Requests Cookies ("User Ink") ("User Name") & amp; "'" AccessDataSource1.SelectCommand = sqlcmd (No Page.IsPostBack) Then the string sqlcmd2 = "update [UserTable] set to [first] as sqlcmd2 dim = ?, [secondName] =?, [User name] = ?, [date of birth] =?, [P] Sward] =? Where [UserID] =? And IsNull (([first] =?) Or ([first]? Zero) is zero and is) and (([SecondName] =?) Or ([SecondName] is tap and is cylindrical) and (([username] =?) Or ([username] is tap and tap?) And (([dob] =?) Or ([dob] is tap and tap?) And (([password] =?) Or ([password ] Is zero and zero)) "AccessDataSource1.UpdateCommand = sqlcmd2 end then End Sub   
  form id =" webform "runat =" server "& Gt; div id =" content "& gt; & lt; ASP: AccessDataSource id =" AccessDataSource1 "DataSourceMode =" dataset "runat =" server "ConflictDetection =" CompareAllValues ​​"datafile =" ~ / Database.mdb "OldValuesParameterFormatString =" original_ {0} "UpdateComman D = "Update [User Name] = [, First name] =?, [Second name] =?, [Username] = ?, [dob] = ?, [password] =? Where [userID] = and? Iusnl (([first Name] =?) Or ([first name] is zero and is zero)) and (([SecondName] =?) Or ([secondName] is zero and is zero)) and (([username] =? ) Or ([user name] is zero and is void) and (([dob] =?) Or ([dob] tap and? Null) and (([password] =?) Or ([password] is nose and null?) "> UpdateParameters & gt; asp: parameter name =" UserID "type =" Int32 Asp: parameter name = "firstname" type = "string" /> gt; asp: parameter name = "second name" type = "string" /> & lt; asp: Parameter name = "user name" type = "string" /> asp: parameter name = "DOB" type = "string" /> & lt; asp: parameter name = "password" type = "String" /> gt; & lt; ap: parameter name = "parent_USI" RID "type =" int32 "/>  gt; asp: parameter name =" original_name "type =" String name / " : Parameter name = "original_username" type = "string" /> gt; asp: parameter name = "original_username" type = "string" /> & lt; asp: parameter name = "original_DOB" HE Government = "string" / & gt; & Lt; Asp: parameter name = "original_DOB" type = "string" /> & Lt; Asp: parameter name = "original_Password" type = "string" / & gt; & Lt; Asp: parameter name = "original_Password" type = "string" / & gt; & Lt; / UpdateParameters & gt; & Lt; / ASP: AccessDataSource & gt; & Lt; Asp: gridview id = "gridview 1" runat = "server" datasource id = "accessdate source 1" & gt; & Lt; Columns & gt; & Lt; Asp: CommandField ShowEditButton = "True" /> & Lt; / Column & gt; & Lt; / ASP: GridView & gt; & Lt; Div & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; / Form & gt; Sorry if all this is messy but this is my first post and I am not sure what I am doing.   

Try adding

  accessdatasource1.update ()    

No comments:

Post a Comment