CODE
Private Sub bindingNavigatorButton_save_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_save.Click
'Try
'Me.Validate()
'Me.myDatabaseBindingSource.EndEdit()
'Me.myDatabaseTableAdapter.Update(Me.myDatabaseDataSet.myDatabase)
'MsgBox("Update successful")
'Catch ex As Exception
'MsgBox("Update failed")
'End Try
If TextBox1.Text <> "" And TextBox2.Text <> "" Then
'ucmd.CommandText = "UPDATE myDatabase SET area = '" & TextBox2.Text & "WHERE id = " & Label14.Text & ""
ucmd.CommandText = "UPDATE myDatabase SET level = '" & TextBox1.Text & "' ,area='" & TextBox2.Text & "' WHERE 'id'='" & Label14.Text & "'"
ucmd.CommandType = CommandType.Text
ucmd.Connection = cn2
ucmd.ExecuteNonQuery()
myDatabaseDataSet.AcceptChanges()
ucmd.Connection.Close()
MsgBox("Record Updated.")
Else
MsgBox("Enter the required values:")
End If
'ucmd.Dispose()
End Sub
also, i have change 'Copy to Output directory' option to 'Copy if Newer'
am i doing it right?
ermm..still not work...
actually, i need to create a form that retrieve data that i have already display at the main form..i did it
CODE
Public Sub New(ByVal nameText As String, ByVal blockText As String, ByVal areaText As String, ByVal levelText As String, ByVal totalText As String, ByVal idText As String)
InitializeComponent()
Label9.Text = nameText
Label10.Text = blockText
Label11.Text = areaText
Label12.Text = levelText
Label13.Text = totalText
Label14.Text = idText
'TextBox1.Text = levelText
'TextBox2.Text = areaText
then, i open new connection from that second form to do UPDATE..
just because it cant...so i try to do it at the main form only..but still not work...huhuuu~
This post has been edited by skyline85: 29 Jun, 2009 - 07:25 PM