Last post May 24, 2010 01:09 AM by mestizo
May 24, 2010 12:03 AM|mestizo|LINK
Hi, I am using MS Access Database and I have
Protected Sub Button1_Click()
Dim con As New OleDbConnection con.ConnectionString = System.Configuration.ConfigurationManager.AppSettings("ConStr")
Dim editrec As New OleDbCommand("Update Jobseeker SET Height = '" & TextBox6.Text & "', Weight = '" & TextBox7.Text & "' where IdNo = '" & Session("Id") & "' ", con)
There is error in the code. But when I click update button, the request execute but my database doesn't get updated of the new values that I entered. Someone help me about this..
May 24, 2010 12:34 AM|Mikesdotnetting|LINK
You need to check to see if Session("Id") contains a value, and there is a matching one in the database you are trying to update. You should also make sure you are not looking in one version of the database, but updating another somewhere, so if you have
multiple copies of the database, check your connection string.
Also, you should use parameters:
Parameter Queries in ASP.NET with MS Access
May 24, 2010 12:42 AM|mestizo|LINK
Yes . Session("Id") does have a value. I check it by using msgbox(Session("Id")) at form load. Also Im sure there is a match because In the form load, I populate all the textbox with the current value of from the database of that user.
I use OleDbDateReader to retrieve records and put into the textboxes. And Suddenly my update doesn't reflect the changes in my database when the request is sent.
May 24, 2010 12:55 AM|Mikesdotnetting|LINK
If your values (Height, Id etc) are numeric values, the syntax you showed in your first post is wrong. You have incorrect delimiters. Try using parameters.
May 24, 2010 01:09 AM|mestizo|LINK
Doesn't matter if they are numeric. They are all stored as text in the database. And also, Im testing values of by inputing letters or numbers both does not work. Still my database is not updated. I am using this syntax in VWD and also in VS. But now it
seems it doesn't work for me