what's the problem on my save button's code?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • fridrai
    New Member
    • Jun 2013
    • 9

    what's the problem on my save button's code?

    hi every body,
    i've got a problem on my save button: the same code with another table update (account) is working well, but the article's one is blocked, and i don't know why, every time i fill in the comboboxes and the textboxes then click on save button, it runs nomore, and when i'm back to the source code on my edi visual studio, i find the cursor blinking on the datadapt lines,
    here is the code:
    Code:
    Private Sub ButtnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtnSave.Click
    		sql = "select * from gm862"
    		cmd = New MySqlCommand(sql)
    		dataadapt = New MySqlDataAdapter(cmd)
    		datset = New DataSet
    		cmd.Connection() = cn
    		dataadapt.Fill(datset, "gm862")	'dataadapter.Fill=remplir
    		datatab = datset.Tables("gm862")
    		If txtimei.Text = "" Or cmbxartifact.Text = "" Or cbxsurename.Text = "" Or cbxforename.Text = "" Or cmbxintiallatitude.Text = "" Or cmbxinitiallongitude.Text = "" Or txtcurrentlongitude.Text = "" Or txtcurrentlongitude.Text = "" Or datelab.Text = "" Or timelabuct.Text = "" Then
    			MsgBox("Please fill in all fields !", MsgBoxStyle.Information, "Information")
    		Else
    			datrow = datset.Tables("gm862").NewRow
    			datrow("refgm862") = txtimei.Text
    			datrow("artefact") = cmbxartifact.Text
    			datrow("usersurename") = cbxsurename.Text
    			datrow("userforename") = cbxforename.Text
    			datrow("initiallatitude") = CDbl(cmbxintiallatitude.Text)
    			datrow("initiallongitude") = CDbl(cmbxinitiallongitude.Text)
    			datrow("currentlattitude") = CDbl(txtcurrentlattitude.Text)
    			datrow("currentlongitude") = CDbl(txtcurrentlongitude.Text)
    			datrow("trackingdate") = CDate(datelab.Text)
    			datrow("trackingtime") = CDate(timelabuct.Text)
    			datset.Tables("gm862").Rows.Add(datrow)
    			cmdb = New MySqlCommandBuilder(dataadapt)
    			dataadapt.Update(datset, "gm862")
    			datset.Clear()
    			dataadapt.Fill(datset, "gm862")
    			datatab = datset.Tables("gm862")
    			cbxforename.Text = ""
    			cbxsurename.Text = ""
    			cmbxartifact.Text = ""
    			txtimei.Text = ""
    			cmbxintiallatitude.Text = ""
    			cmbxinitiallongitude.Text = ""
    			txtcurrentlongitude.Text = ""
    			txtcurrentlongitude.Text = ""
    			datelab.Text = ""
    			timelabuct.Text = ""
    			ButnNew.Enabled = True
    			ButtnSave.Enabled = True
    			cmbxGM862Findby.Enabled = True
    		End If
    is the problem related to date and the time? as i am using a label for the time and date, should i replace them by txtboxes?
    waiting for ur help
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    Put a break point before and look at your sql update statement.
    Is it correct?

    Comment

    Working...