Answered by:
oledb connection

Question
-
User694604870 posted
hi
i am trying to update my database via a textbox on my web page.
so that when a number is entered into this textbox and the button is clicked, it goes and changes the previous value to the one u have just entered.
but its not working :(
here is my code.
*****************************************************************************
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
Try
' cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\Ash\MyDocuments\platypus_holidays.mdb;") 'Connection String
cn.Open()
str = "update holidays set holidays_left=" & CInt(TextBox3.Text)
cmd = New OleDbCommand(str, cn)
icount = cmd.ExecuteNonQuery
TextBox4.Text = "The value was change to " & icount
Catch
TextBox4.Text = "The value was not Updated"
End Try
update_holiday_values()
cn.Close()
End Sub*********************************************************************************************
any help would be greatly appreciated!!
also i am quite new to this so simple answers and samples of code would be great!
thanks in advance.
Thursday, October 21, 2010 10:32 PM
Answers
-
User-1148431695 posted
Hi,
The method ExecuteNonQuery() will return you the number of records affected. If you want to display the updated value from the table, you will need to write sql select query to get the data from the table and store it in variable.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Friday, October 22, 2010 2:04 AM
All replies
-
User-1148431695 posted
Hi,
The method ExecuteNonQuery() will return you the number of records affected. If you want to display the updated value from the table, you will need to write sql select query to get the data from the table and store it in variable.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Friday, October 22, 2010 2:04 AM -
User-1696311824 posted
Hi
ExecuteNonQuery() is methods.. and its returns no of afftected rows in Icount...
for changed values write select holidays_left from holiday where.... condition...
it should work. if u have any error. let me know.......
Thanks
Thursday, June 16, 2011 10:40 PM -
User-1696311824 posted
hi
For ur query.. please refere this link
http://rathodbhavesh.wordpress.com/2011/05/08/oledbconnection/
Thanks
Bhavesh Rathod
Thursday, June 16, 2011 10:42 PM