0

Ive got some information that i want to be sent to the database, first the information is taken from the database to the textboxes which works, i will then be able to edit the text, and send back to the database, ive got the Command all coded but when i type in the new data, and the button is clicked it jus refreshes back with the old data.. no data is saved to the database, if anyone can help heres the code..

Dim strSQL As String = "UPDATE bloginformation SET Title ='" & txtTitle.Text & "', Information ='" & txtInformation.Text & "' WHERE blogid=" & Label3.Text & ""
               Dim Cmd As New OleDbCommand(strSQL, Connection)
        Cmd.ExecuteReader()
        Connection.Close()

My connection is working fine, and also used a breakpoint to see if they were holding any values and they was, its just not updating please help me thanks

2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by jbisono
0

Insted of use cmd.ExecuteReader() use cmd.ExecuteNonQuery(), ExecuteNonQuery Return an integer on how many rows were affected by that query.

0

Insted of use cmd.ExecuteReader() use cmd.ExecuteNonQuery(), ExecuteNonQuery Return an integer on how many rows were affected by that query.

Already tried that , didnt work lol.. ive tried page.ifpostback aswell but that isnt working either

0

Did you open the connection before you do the ExecuteNonQuery()?

Dim Cmd As New OleDbCommand(strSQL, Connection)
Connection.Open()
Cmd.ExecuteNonQuery()
Connection.Close()

if that does not work i would say try to pass a straightforward statement, just to make sure the statement is not wrong.

Page ispostback maybe you want to do that in page load event.

Edited by jbisono: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.