You are on page 1of 2

Private Sub saveDataBase()

CURRENT_POSITION = Tbl_UniversityBindingSource.Position
Try
'If SaveStatus = 1 Then
' Me.Validate()
' Me.Tbl_UniversityBindingSource.EndEdit()
' Me.TableAdapterManager.UpdateAll(Me.Db_LibraryDataSet)
' MsgBox("Update successful")
'ElseIf SaveStatus = 2 Then
' Dim connectionString As String
' connectionString = setConnectionString()
' Dim query As String
' Dim conn As New System.Data.OleDb.OleDbConnection(connectionStr
ing)
' Dim cmd As New System.Data.OleDb.OleDbCommand
' cmd.CommandType = System.Data.CommandType.Text
' query = "UPDATE tbl_University SET [RegnNo] = '" + RegnNoTextBo
x.Text.ToString() + "', "
' query = query + "[Name] = " + NameTextBox.Text.ToString() + ",
"
' query = query + "[Fathername] = " + FatherNameTextBox.Text.ToSt
ring() + ", "
' query = query + "[Address1] = " + Address1TextBox.Text.ToString
() + ", "
' query = query + "[Address2] = " + Address2TextBox.Text.ToString
() + ", "
' query = query + "[City] = " + CityTextBox.Text.ToString() + ",
"
' query = query + "[State] = " + StateTextBox.Text.ToString() + "
, "
' query = query + "[PINCode] = " + PINCodeTextBox.Text.ToString()
+ ", "
' query = query + "[E-mail] = " + E_mailTextBox.Text.ToString() +
", "
' query = query + "[Phone] = " + PhoneTextBox.Text.ToString() + "
, "
' query = query + "[Mobile] = " + MobileTextBox.Text.ToString() +
", "
' 'query = query + "[DOB] = " + DOBDateTimePicker.Text.ToString()
+ ", "
' query = query + "[CourseSemester] = " + CourseSemesterTextBox.T
ext.ToString() + ", "
' query = query + "[Batch] = " + BatchTextBox.Text.ToString() + "
, "
' query = query + "[Status] = " + StatusTextBox.Text.ToString() +
", "
' query = query + "[HavePic] = " + HavePicCheckBox.Checked + ", "
' 'query = query + "[Picture] = " + +", "
' query = query + "[Description] = " + DescriptionTextBox.Text.To
String() + ", "
' query = query + "WHERE (CourseSemesterID = " + CourseSemesterID
TextBox.Text + ")"
' cmd.CommandText = query
' cmd.Connection = conn
' conn.Open()
' cmd.ExecuteNonQuery()
' conn.Close()
' MsgBox("Update successful")
'End If
Catch ex As Exception
MsgBox("Update failed")
MsgBox(ex.Message.ToString())
End Try
MakeTextBoxReadOnly(True, True)
EnableDisableButtons(True, True, True, False, False, True)
Me.Tbl_UniversityTableAdapter.Fill(Me.Db_LibraryDataSet.tbl_University)
Tbl_UniversityBindingSource.Position = CURRENT_POSITION
SaveStatus = 0
End Sub

You might also like