iam saving the data into Ms-Access database using Vb.net Application
In that application iam using Data grid view to save the data into the database
Here in the below code iam saving the name of stalls into the database
i have to save according to number given in the textbox .but first i saved only two stallnames and next time i want to save the remaining stall names then it is not possible it checks the starting two stallnames and showing the message box "Stallname already saved" .but iam appending the data here
how could i im sending code please check it once any one reply me
While k < grvStalls.Rows.Count - 1
For k = 0 To grvStalls.Rows.Count - 1 Step 1
For p = 0 To 3 Step 1
str1 = "select Stallname from StallName where Stallname= '" & grvStalls.Rows(k).Cells(p).Value & "' and Eventid=" & cmbEvent.SelectedItem.datavalue & " "
emsg = ""
emsg = dbcon.GetCheckFlag(str1, flag1)
If emsg = "" Then
If flag1 = 0 Then
If grvStalls.Rows(k).Cells(p).Value <> "" Then
grvStalls.Rows(k).Cells(p).Value = Replace(Trim(grvStalls.Rows(k).Cells(p).Value), "'", "''")
str = "" & cmbEvent.SelectedItem.datavalue & ", " & _
"'" & grvStalls.Rows(k).Cells(p).Value & "'"
emsg = ""
dbcon.savestallname(str, emsg, stid)
End If
Else
MessageBox.Show("Stallname Already Saved")
Exit Sub
End If
End If
Next
Next
End While
If emsg = "" Then
MessageBox.Show("record saved")
'Exit Sub
Else
MessageBox.Show(emsg)
End If