Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2012
    Posts
    32

    Unanswered: How do I update a database entry from a textbox?

    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

  2. #2
    Join Date
    Apr 2012
    Posts
    12
    Did you use Microsoft Jet 4.0 OLE DB Provider to connect your VB to Access?

  3. #3
    Join Date
    Aug 2012
    Posts
    32
    Im connected to sql...I used a connection string that didnt require the provider

    just the server, database, uid, and password

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •