I have been on a database project for a while now. I wanted to be able to make changes to my database using the update command of a Datagridview control.However, I have been faced with a series of unsuccessful outcomes.I want to do this how do I go about it?
Public Sub InsertInformation()
Dim connex As MySqlConnection
Dim theNumber, tryNumber As Integer
Dim MyCommandText, coll As String
Dim NameOne, RankOne, StaffNosOne, DepartmentOne, BankOne, AccountNosOne, BranchOne, AdditionCommentOne, DeductionCommentOne As String
Dim GradeOne, StepOne As Integer
Dim DriverAllowanceOne, PensionOne, VehicleOne, NonAccidentOne, AdditionOne, CTCSOne, DeductionsOne As Double
MyCommandText = " insert into " & MyFileTableText & " values(" & NameOne & "," & GradeOne & "," & StepOne & "," & RankOne & "," & _
StaffNosOne & "," & DepartmentOne & "," & BankOne & "," & AccountNosOne & "," & BranchOne & ");"
connex = New MySqlConnection
connex.ConnectionString = "server=127.0.0.1;" & "uid=root;" & "pwd = instructed;"
myCommand.Connection = connex
myAdapter.UpdateCommand = myCommand
Dim cmdbuilder As New MySqlCommandBuilder(myAdapter)
Dim i As Integer
i = myAdapter.Update(myDataSet, "myData")
MsgBox("Records Updated= " & i)
Catch ex As Exception
Catch myerror As MySqlException 'Exception
MessageBox.Show("Error UpdatingDatabase: " & myerror.Message)
This post has been edited by origen2g: 25 May 2010 - 06:56 AM