Saving Data in Second time Entry

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • madhu raju
    New Member
    • Mar 2008
    • 1

    #1

    Saving Data in Second time Entry

    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).Val ue & "' and Eventid=" & cmbEvent.Select edItem.datavalu e & " "
    emsg = ""
    emsg = dbcon.GetCheckF lag(str1, flag1)
    If emsg = "" Then
    If flag1 = 0 Then
    If grvStalls.Rows( k).Cells(p).Val ue <> "" Then
    grvStalls.Rows( k).Cells(p).Val ue = Replace(Trim(gr vStalls.Rows(k) .Cells(p).Value ), "'", "''")
    str = "" & cmbEvent.Select edItem.datavalu e & ", " & _
    "'" & grvStalls.Rows( k).Cells(p).Val ue & "'"
    emsg = ""
    dbcon.savestall name(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
Working...