Thanks for the reply
Here is the situation. I am populating a DGV with the following code.....
Private Sub cmdupdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdupdate.Click
Dim conn As New MySqlConnection
Dim myCommandlead, myCommandref As New MySqlCommand
Dim myAdapterlead, myadapterref As New MySqlDataAdapter
Dim myDatalead, myDataref As New DataTable
Dim SQLlead, SQLref As String
Dim myuser As String
myuser = lblloggedin.Text
SQLlead = "SELECT p.id,p.name_2 as Forename,p.name_1 as Surname,p.tel1 as Telephone,p.add1 as Address_1,p.add2 as Address_2,p.add3 as Address_3,p.add4 as Address_4,p.postcode as Postcode," _
& "p.cl_type as Claim_Type,p.notes as Notes,concat(t.agent_forename,' ',t.agent_surname) as Lead_Source from postcode_data p,teams t " _
& "where p.ld_date = curdate() and t.agent_ID = p.ld_agent and t.claims_manager = " & "'" & myuser & "'"
SQLref = "select r.referral_id,r.cust_title as Title,r.cust_forename as Forename,r.cust_surname as Surname,r.cust_tel_day as Day_Tel,r.cust_tel_eve as Night_Tel,r.cust_add1 as Address_1,r.cust_add2 as Address_2,r.cust_add3 as Address_3,r.cust_postcode as postcode," _
& "r.claim_type as Claim_Type,r.notes as Notes,concat(t.agent_forename,' ',t.agent_surname) as Lead_Source from referral r,teams t " _
& "where r.date_referral_taken = curdate() and t.agent_id = r.agent_id and t.claims_manager = " & "'" & myuser & "'"
Debug.Print(SQLlead)
conn = New MySqlConnection
conn.ConnectionString = "server=modi;userid=user;password=pword;database=kouse"
Try
conn.Open()
Try
myCommandlead.Connection = conn
myCommandref.connection = conn
myCommandlead.CommandText = SQLlead
myCommandref.CommandText = SQLref
myAdapterlead.SelectCommand = myCommandlead
myadapterref.SelectCommand = myCommandref
myAdapterlead.Fill(myDatalead)
myadapterref.Fill(myDataref)
dgvleads.DataSource = myDatalead
dgvreferral.DataSource = myDataref
'cbousername.DataSource = myData
'cbousername.DisplayMember = "name"
'lblpassword.Text = cbousername.SelectedItem("password")
Catch myerror As MySqlException
MsgBox("There Was an Error Reading From the Database ;" & myerror.Message)
End Try
Catch myerror As MySqlException
MsgBox("There Was an Error Connecting to the Database ;" & myerror.Message)
Finally
If conn.State <> ConnectionState.Closed Then conn.Close()
End Try
End Sub
Now, when a user changed some info..... how do I update the database???