By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,639 Members | 1,326 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,639 IT Pros & Developers. It's quick & easy.

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

fridrai
P: 9
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:
Expand|Select|Wrap|Line Numbers
  1. Private Sub ButtnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtnSave.Click
  2.         sql = "select * from gm862"
  3.         cmd = New MySqlCommand(sql)
  4.         dataadapt = New MySqlDataAdapter(cmd)
  5.         datset = New DataSet
  6.         cmd.Connection() = cn
  7.         dataadapt.Fill(datset, "gm862")    'dataadapter.Fill=remplir
  8.         datatab = datset.Tables("gm862")
  9.         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
  10.             MsgBox("Please fill in all fields !", MsgBoxStyle.Information, "Information")
  11.         Else
  12.             datrow = datset.Tables("gm862").NewRow
  13.             datrow("refgm862") = txtimei.Text
  14.             datrow("artefact") = cmbxartifact.Text
  15.             datrow("usersurename") = cbxsurename.Text
  16.             datrow("userforename") = cbxforename.Text
  17.             datrow("initiallatitude") = CDbl(cmbxintiallatitude.Text)
  18.             datrow("initiallongitude") = CDbl(cmbxinitiallongitude.Text)
  19.             datrow("currentlattitude") = CDbl(txtcurrentlattitude.Text)
  20.             datrow("currentlongitude") = CDbl(txtcurrentlongitude.Text)
  21.             datrow("trackingdate") = CDate(datelab.Text)
  22.             datrow("trackingtime") = CDate(timelabuct.Text)
  23.             datset.Tables("gm862").Rows.Add(datrow)
  24.             cmdb = New MySqlCommandBuilder(dataadapt)
  25.             dataadapt.Update(datset, "gm862")
  26.             datset.Clear()
  27.             dataadapt.Fill(datset, "gm862")
  28.             datatab = datset.Tables("gm862")
  29.             cbxforename.Text = ""
  30.             cbxsurename.Text = ""
  31.             cmbxartifact.Text = ""
  32.             txtimei.Text = ""
  33.             cmbxintiallatitude.Text = ""
  34.             cmbxinitiallongitude.Text = ""
  35.             txtcurrentlongitude.Text = ""
  36.             txtcurrentlongitude.Text = ""
  37.             datelab.Text = ""
  38.             timelabuct.Text = ""
  39.             ButnNew.Enabled = True
  40.             ButtnSave.Enabled = True
  41.             cmbxGM862Findby.Enabled = True
  42.         End If
  43.  
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
Jul 3 '13 #1
Share this Question
Share on Google+
1 Reply


Frinavale
Expert Mod 5K+
P: 9,731
Put a break point before and look at your sql update statement.
Is it correct?
Jul 10 '13 #2

Post your reply

Sign in to post your reply or Sign up for a free account.