Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

How do I update a database entry from a textbox?

$
0
0
Here is my code:
Dim connStr As String = "Provider = SQLNCLI10;Server=xxxxxxx\xxxxxxx;Database=xxxxxx;U id=xxxx;Pwd=xxxxx"
Dim sqlStr As String = "SELECT * FROM Ticket"


Try
Dim OleDbDataAdapter1 As New OleDb.OleDbDataAdapter(sqlStr, connStr)
Dim OleDbConnection1 As New OleDb.OleDbConnection(connStr)
OleDbConnection1.Open()
Dim command As String

'set up an SQL update
command = "UPDATE Ticket SET FixedRev = '" & txtFixedRev.Text & "' where Number = '" & txtDatabaseTicketNo.Text & "'"
OleDbDataAdapter1.UpdateCommand.CommandText = command

'do the update
OleDbDataAdapter1.UpdateCommand.ExecuteNonQuery()
Catch exceptionObject As Exception
MessageBox.Show(exceptionObject.Message)
Finally
End Try

Viewing all articles
Browse latest Browse all 13329

Trending Articles