The Visual Basic 2010 Form - book_note.vb, Text Codes
 
 
 

       
      Return



  The Form -  book_note.vb ...

 
 

 The codes  corresponding ...
   
 
 
Imports System.Data.OleDb

Imports System.Data

Public Class book_note

Inherits System.Windows.Forms.Form

Dim fbook_search As New book_search 'Form

'Note,this software uses:

' logical Connection = dbConnection1, stored at Module1.vb

' logical Data adapter = vda1 & da

' logical Insert Command = OleDbICommand

' logical Connection = dbConnection

Protected Const OleDbConnectionString As String = _

"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\work_VBNet_10\work_VBNet_10\data\work_VBNet.mdb;Persist Security Info=True"

Protected connectionString As String = OleDbConnectionString

Dim dbConnection1 As New OleDbConnection(connectionString)

Dim vselect1 As System.Data.OleDb.OleDbCommand ' Select command

Dim vda1 As System.Data.OleDb.OleDbDataAdapter ' Dataadapter

Dim vdset1 As System.Data.DataSet

Dim da As System.Data.OleDb.OleDbDataAdapter ' Dataadapter

Dim OleDbSCommand = New System.Data.OleDb.OleDbCommand 'Select Command

Dim OleDbICommand = New System.Data.OleDb.OleDbCommand 'Insert Command

Dim OleDbUCommand = New System.Data.OleDb.OleDbCommand 'Update Command

Dim OleDbDCommand = New System.Data.OleDb.OleDbCommand 'Delete Command

 

Dim mbeditflag As Boolean, mbaddflag As Boolean

Dim vbirth_d As String, vbirth_m As String

Dim vbirth_y As String

'list of operations available: navigation, add/new, modify, update, cancel, find/search, print, close

Private Sub book_note_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

'move

Me.editphoto_photo.Top = -Me.editphoto_photo.Height

'resize

Me.Panel21.Top = (Me.Panel2.Height - Me.Panel21.Height) / 2

Me.Panel22.Left = (Me.Panel21.Width - Me.Panel22.Width) / 2

Me.lblNavLocation.Width = Me.Panel22.Left - 16

Me.lblNavLocation.Left = (Me.Panel22.Left - Me.lblNavLocation.Width) / 2

Me.lblNavLocation.Top = 0

Me.lboperation.Width = Me.lblNavLocation.Width

Me.lboperation.Left = Me.Panel22.Left + (Me.Panel22.Left - Me.lblNavLocation.Width) / 2

Me.lboperation.Top = Me.lblNavLocation.Top

Me.Panel91.Top = Me.Panel4.Top

Me.Panel41.Left = Me.Panel91.Left

Me.Panel42.Left = Me.Panel91.Left

' Me.Panel41.Width = 2 * Me.Panel91.Width + Me.Panel4.Width

Me.Panel91.Height = Me.Panel4.Height + Me.Panel41.Height + Me.Panel5.Height + Me.Panel42.Height + Me.Panel6.Height

Me.Panel41.Top = Me.Panel4.Top + Me.Panel4.Height

Me.Panel5.Top = Me.Panel41.Top + Me.Panel41.Height

Me.Panel42.Top = Me.Panel5.Top + Me.Panel5.Height

Me.Panel6.Top = Me.Panel42.Top + Me.Panel42.Height

Me.Panel43.Top = Me.Panel6.Top + Me.Panel6.Height

Me.Panel5.Left = Me.Panel4.Left

Me.Panel6.Left = Me.Panel4.Left

Me.Pic_line01.Width = Me.Panel4.Width

Me.Pic_line01.Left = Me.Panel91.Width

Me.Pic_line02.Width = Me.Pic_line01.Width

Me.Pic_line02.Left = Me.Pic_line01.Left

Me.Panel3.Height = Me.Panel43.Top - 8

Me.Panel3.Top = 4

Me.Pic_book.Left = (Me.Panel3.Width - Me.Pic_book.Width) / 2

Me.Pic_book.Top = Me.Panel33.Top + Me.Panel33.Height + (Me.Panel3.Height - (Me.Panel33.Top + Me.Panel33.Height + Me.Pic_book.Height)) / 2

 

Me.ltoday.Text = FormatDateTime(Date.Now, DateFormat.LongDate)

'Initialized DataAdapter da

daDataAdapter()

 

Try

'Attempt to load the dataset.

'load book table, book_dset1 dataset

Me.LoadDataSet()

NavFirst()

' Navigation controls, enebled(False or True

NavigationFP(False)

NavigationNL(True)

'clear comboboxes

clearcombo()

sub_load("name")

sub_load("first")

sub_load("father")

sub_load("city")

sub_load("civil_status")

 

 

 

 

Catch eLoad As System.Exception

'Add your error handling code here.

'Display error message, if any.

System.Windows.Forms.MessageBox.Show(eLoad.Message)

End Try

 

End Sub

'clear comboboxes

Private Sub clearcombo()

Me.cmbname.Items.Clear()

Me.cmbfirst_name.Items.Clear()

Me.cmbfather_name.Items.Clear()

Me.cmbcity.Items.Clear()

Me.cmbcivil_status.Items.Clear()

End Sub

'Initialized DataAdapter da

Private Sub daDataAdapter()

'Select Command, Values

OleDbSCommand = New OleDb.OleDbCommand("SELECT address1, address2, alternativePhone, birth, birth_d, birth_m, birth_y, bookid, city, civil_status, country, email, father_name, fax, first_name, function, homephone, mobilephone, name, originalfirst_name, Photo, [post-office_box], sex, web, workphone FROM book ORDER BY bookid")

OleDbSCommand.Connection() = dbConnection1 ' Select command

'Insert Command,Values

OleDbICommand.CommandText = "INSERT INTO book(address1, address2, alternativePhone, birth, birth_d, birth_m, b" & _

"irth_y, city, civil_status, country, email, father_name, fax, first_name, functi" & _

"on, homephone, mobilephone, name, originalfirst_name, Photo, [post-office_box], " & _

"sex, web, workphone) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, " & _

"?, ?, ?, ?, ?, ?, ?)"

OleDbICommand.Connection = dbConnection1

OleDbICommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("address1", System.Data.OleDb.OleDbType.VarWChar, 255, "address1"))

OleDbICommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("address2", System.Data.OleDb.OleDbType.VarWChar, 255, "address2"))

OleDbICommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("alternativePhone", System.Data.OleDb.OleDbType.VarWChar, 30, "alternativePhone"))

OleDbICommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("birth", System.Data.OleDb.OleDbType.DBDate, 0, "birth"))

OleDbICommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("birth_d", System.Data.OleDb.OleDbType.VarWChar, 25, "birth_d"))

OleDbICommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("birth_m", System.Data.OleDb.OleDbType.VarWChar, 25, "birth_m"))

OleDbICommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("birth_y", System.Data.OleDb.OleDbType.VarWChar, 25, "birth_y"))

OleDbICommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("city", System.Data.OleDb.OleDbType.VarWChar, 25, "city"))

OleDbICommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("civil_status", System.Data.OleDb.OleDbType.VarWChar, 50, "civil_status"))

OleDbICommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("country", System.Data.OleDb.OleDbType.VarWChar, 25, "country"))

OleDbICommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("email", System.Data.OleDb.OleDbType.VarWChar, 50, "email"))

OleDbICommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("father_name", System.Data.OleDb.OleDbType.VarWChar, 50, "father_name"))

OleDbICommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("fax", System.Data.OleDb.OleDbType.VarWChar, 30, "fax"))

OleDbICommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("first_name", System.Data.OleDb.OleDbType.VarWChar, 50, "first_name"))

OleDbICommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("function", System.Data.OleDb.OleDbType.VarWChar, 150, "function"))

OleDbICommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("homephone", System.Data.OleDb.OleDbType.VarWChar, 30, "homephone"))

OleDbICommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("mobilephone", System.Data.OleDb.OleDbType.VarWChar, 30, "mobilephone"))

OleDbICommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("name", System.Data.OleDb.OleDbType.VarWChar, 50, "name"))

OleDbICommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("originalfirst_name", System.Data.OleDb.OleDbType.VarWChar, 50, "originalfirst_name"))

OleDbICommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Photo", System.Data.OleDb.OleDbType.VarWChar, 255, "Photo"))

OleDbICommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("post_office_box", System.Data.OleDb.OleDbType.VarWChar, 25, "post-office_box"))

OleDbICommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("sex", System.Data.OleDb.OleDbType.VarWChar, 25, "sex"))

OleDbICommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("web", System.Data.OleDb.OleDbType.VarWChar, 50, "web"))

OleDbICommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("workphone", System.Data.OleDb.OleDbType.VarWChar, 30, "workphone"))

'Delete Command, Values

OleDbDCommand.CommandText = "DELETE FROM book WHERE (bookid = ?) AND (Photo = ? OR ? IS NULL AND Photo IS NULL" & _

") AND (address1 = ? OR ? IS NULL AND address1 IS NULL) AND (address2 = ? OR ? IS" & _

" NULL AND address2 IS NULL) AND (alternativePhone = ? OR ? IS NULL AND alternati" & _

"vePhone IS NULL) AND (birth = ? OR ? IS NULL AND birth IS NULL) AND (birth_d = ?" & _

" OR ? IS NULL AND birth_d IS NULL) AND (birth_m = ? OR ? IS NULL AND birth_m IS " & _

"NULL) AND (birth_y = ? OR ? IS NULL AND birth_y IS NULL) AND (city = ? OR ? IS N" & _

"ULL AND city IS NULL) AND (civil_status = ? OR ? IS NULL AND civil_status IS NUL" & _

"L) AND (country = ? OR ? IS NULL AND country IS NULL) AND (email = ? OR ? IS NUL" & _

"L AND email IS NULL) AND (father_name = ? OR ? IS NULL AND father_name IS NULL) " & _

"AND (fax = ? OR ? IS NULL AND fax IS NULL) AND (first_name = ? OR ? IS NULL AND " & _

"first_name IS NULL) AND (function = ? OR ? IS NULL AND function IS NULL) AND (ho" & _

"mephone = ? OR ? IS NULL AND homephone IS NULL) AND (mobilephone = ? OR ? IS NUL" & _

"L AND mobilephone IS NULL) AND (name = ? OR ? IS NULL AND name IS NULL) AND (ori" & _

"ginalfirst_name = ? OR ? IS NULL AND originalfirst_name IS NULL) AND ([post-offi" & _

"ce_box] = ? OR ? IS NULL AND [post-office_box] IS NULL) AND (sex = ? OR ? IS NUL" & _

"L AND sex IS NULL) AND (web = ? OR ? IS NULL AND web IS NULL) AND (workphone = ?" & _

" OR ? IS NULL AND workphone IS NULL)"

OleDbDCommand.Connection = dbConnection1

OleDbDCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_bookid", System.Data.OleDb.OleDbType.Integer, 0, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "bookid", System.Data.DataRowVersion.Original, Nothing))

OleDbDCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_Photo", System.Data.OleDb.OleDbType.VarWChar, 255, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "Photo", System.Data.DataRowVersion.Original, Nothing))

OleDbDCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_Photo1", System.Data.OleDb.OleDbType.VarWChar, 255, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "Photo", System.Data.DataRowVersion.Original, Nothing))

OleDbDCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_address1", System.Data.OleDb.OleDbType.VarWChar, 255, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "address1", System.Data.DataRowVersion.Original, Nothing))

OleDbDCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_address11", System.Data.OleDb.OleDbType.VarWChar, 255, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "address1", System.Data.DataRowVersion.Original, Nothing))

OleDbDCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_address2", System.Data.OleDb.OleDbType.VarWChar, 255, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "address2", System.Data.DataRowVersion.Original, Nothing))

OleDbDCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_address21", System.Data.OleDb.OleDbType.VarWChar, 255, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "address2", System.Data.DataRowVersion.Original, Nothing))

OleDbDCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_alternativePhone", System.Data.OleDb.OleDbType.VarWChar, 30, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "alternativePhone", System.Data.DataRowVersion.Original, Nothing))

OleDbDCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_alternativePhone1", System.Data.OleDb.OleDbType.VarWChar, 30, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "alternativePhone", System.Data.DataRowVersion.Original, Nothing))

OleDbDCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_birth", System.Data.OleDb.OleDbType.DBDate, 0, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "birth", System.Data.DataRowVersion.Original, Nothing))

OleDbDCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_birth1", System.Data.OleDb.OleDbType.DBDate, 0, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "birth", System.Data.DataRowVersion.Original, Nothing))

OleDbDCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_birth_d", System.Data.OleDb.OleDbType.VarWChar, 25, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "birth_d", System.Data.DataRowVersion.Original, Nothing))

OleDbDCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_birth_d1", System.Data.OleDb.OleDbType.VarWChar, 25, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "birth_d", System.Data.DataRowVersion.Original, Nothing))

OleDbDCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_birth_m", System.Data.OleDb.OleDbType.VarWChar, 25, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "birth_m", System.Data.DataRowVersion.Original, Nothing))

OleDbDCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_birth_m1", System.Data.OleDb.OleDbType.VarWChar, 25, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "birth_m", System.Data.DataRowVersion.Original, Nothing))

OleDbDCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_birth_y", System.Data.OleDb.OleDbType.VarWChar, 25, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "birth_y", System.Data.DataRowVersion.Original, Nothing))

OleDbDCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_birth_y1", System.Data.OleDb.OleDbType.VarWChar, 25, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "birth_y", System.Data.DataRowVersion.Original, Nothing))

OleDbDCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_city", System.Data.OleDb.OleDbType.VarWChar, 25, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "city", System.Data.DataRowVersion.Original, Nothing))

OleDbDCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_city1", System.Data.OleDb.OleDbType.VarWChar, 25, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "city", System.Data.DataRowVersion.Original, Nothing))

OleDbDCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_civil_status", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "civil_status", System.Data.DataRowVersion.Original, Nothing))

OleDbDCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_civil_status1", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "civil_status", System.Data.DataRowVersion.Original, Nothing))

OleDbDCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_country", System.Data.OleDb.OleDbType.VarWChar, 25, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "country", System.Data.DataRowVersion.Original, Nothing))

OleDbDCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_country1", System.Data.OleDb.OleDbType.VarWChar, 25, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "country", System.Data.DataRowVersion.Original, Nothing))

OleDbDCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_email", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "email", System.Data.DataRowVersion.Original, Nothing))

OleDbDCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_email1", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "email", System.Data.DataRowVersion.Original, Nothing))

OleDbDCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_father_name", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "father_name", System.Data.DataRowVersion.Original, Nothing))

OleDbDCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_father_name1", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "father_name", System.Data.DataRowVersion.Original, Nothing))

OleDbDCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_fax", System.Data.OleDb.OleDbType.VarWChar, 30, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "fax", System.Data.DataRowVersion.Original, Nothing))

OleDbDCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_fax1", System.Data.OleDb.OleDbType.VarWChar, 30, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "fax", System.Data.DataRowVersion.Original, Nothing))

OleDbDCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_first_name", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "first_name", System.Data.DataRowVersion.Original, Nothing))

OleDbDCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_first_name1", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "first_name", System.Data.DataRowVersion.Original, Nothing))

OleDbDCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_function", System.Data.OleDb.OleDbType.VarWChar, 150, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "function", System.Data.DataRowVersion.Original, Nothing))

OleDbDCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_function1", System.Data.OleDb.OleDbType.VarWChar, 150, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "function", System.Data.DataRowVersion.Original, Nothing))

OleDbDCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_homephone", System.Data.OleDb.OleDbType.VarWChar, 30, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "homephone", System.Data.DataRowVersion.Original, Nothing))

OleDbDCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_homephone1", System.Data.OleDb.OleDbType.VarWChar, 30, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "homephone", System.Data.DataRowVersion.Original, Nothing))

OleDbDCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_mobilephone", System.Data.OleDb.OleDbType.VarWChar, 30, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "mobilephone", System.Data.DataRowVersion.Original, Nothing))

OleDbDCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_mobilephone1", System.Data.OleDb.OleDbType.VarWChar, 30, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "mobilephone", System.Data.DataRowVersion.Original, Nothing))

OleDbDCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_name", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "name", System.Data.DataRowVersion.Original, Nothing))

OleDbDCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_name1", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "name", System.Data.DataRowVersion.Original, Nothing))

OleDbDCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_originalfirst_name", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "originalfirst_name", System.Data.DataRowVersion.Original, Nothing))

OleDbDCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_originalfirst_name1", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "originalfirst_name", System.Data.DataRowVersion.Original, Nothing))

OleDbDCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_post_office_box", System.Data.OleDb.OleDbType.VarWChar, 25, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "post-office_box", System.Data.DataRowVersion.Original, Nothing))

OleDbDCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_post_office_box1", System.Data.OleDb.OleDbType.VarWChar, 25, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "post-office_box", System.Data.DataRowVersion.Original, Nothing))

OleDbDCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_sex", System.Data.OleDb.OleDbType.VarWChar, 25, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "sex", System.Data.DataRowVersion.Original, Nothing))

OleDbDCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_sex1", System.Data.OleDb.OleDbType.VarWChar, 25, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "sex", System.Data.DataRowVersion.Original, Nothing))

OleDbDCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_web", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "web", System.Data.DataRowVersion.Original, Nothing))

OleDbDCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_web1", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "web", System.Data.DataRowVersion.Original, Nothing))

OleDbDCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_workphone", System.Data.OleDb.OleDbType.VarWChar, 30, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "workphone", System.Data.DataRowVersion.Original, Nothing))

OleDbDCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_workphone1", System.Data.OleDb.OleDbType.VarWChar, 30, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "workphone", System.Data.DataRowVersion.Original, Nothing))

'Update Command, Values

OleDbUCommand.CommandText = "UPDATE book SET address1 = ?, address2 = ?, alternativePhone = ?, birth = ?, birt" & _

"h_d = ?, birth_m = ?, birth_y = ?, city = ?, civil_status = ?, country = ?, emai" & _

"l = ?, father_name = ?, fax = ?, first_name = ?, function = ?, homephone = ?, mo" & _

"bilephone = ?, name = ?, originalfirst_name = ?, Photo = ?, [post-office_box] = " & _

"?, sex = ?, web = ?, workphone = ? WHERE (bookid = ?) AND (Photo = ? OR ? IS NUL" & _

"L AND Photo IS NULL) AND (address1 = ? OR ? IS NULL AND address1 IS NULL) AND (a" & _

"ddress2 = ? OR ? IS NULL AND address2 IS NULL) AND (alternativePhone = ? OR ? IS" & _

" NULL AND alternativePhone IS NULL) AND (birth = ? OR ? IS NULL AND birth IS NUL" & _

"L) AND (birth_d = ? OR ? IS NULL AND birth_d IS NULL) AND (birth_m = ? OR ? IS N" & _

"ULL AND birth_m IS NULL) AND (birth_y = ? OR ? IS NULL AND birth_y IS NULL) AND " & _

"(city = ? OR ? IS NULL AND city IS NULL) AND (civil_status = ? OR ? IS NULL AND " & _

"civil_status IS NULL) AND (country = ? OR ? IS NULL AND country IS NULL) AND (em" & _

"ail = ? OR ? IS NULL AND email IS NULL) AND (father_name = ? OR ? IS NULL AND fa" & _

"ther_name IS NULL) AND (fax = ? OR ? IS NULL AND fax IS NULL) AND (first_name = " & _

"? OR ? IS NULL AND first_name IS NULL) AND (function = ? OR ? IS NULL AND functi" & _

"on IS NULL) AND (homephone = ? OR ? IS NULL AND homephone IS NULL) AND (mobileph" & _

"one = ? OR ? IS NULL AND mobilephone IS NULL) AND (name = ? OR ? IS NULL AND nam" & _

"e IS NULL) AND (originalfirst_name = ? OR ? IS NULL AND originalfirst_name IS NU" & _

"LL) AND ([post-office_box] = ? OR ? IS NULL AND [post-office_box] IS NULL) AND (" & _

"sex = ? OR ? IS NULL AND sex IS NULL) AND (web = ? OR ? IS NULL AND web IS NULL)" & _

" AND (workphone = ? OR ? IS NULL AND workphone IS NULL)"

OleDbUCommand.Connection = dbConnection1

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("address1", System.Data.OleDb.OleDbType.VarWChar, 255, "address1"))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("address2", System.Data.OleDb.OleDbType.VarWChar, 255, "address2"))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("alternativePhone", System.Data.OleDb.OleDbType.VarWChar, 30, "alternativePhone"))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("birth", System.Data.OleDb.OleDbType.DBDate, 0, "birth"))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("birth_d", System.Data.OleDb.OleDbType.VarWChar, 25, "birth_d"))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("birth_m", System.Data.OleDb.OleDbType.VarWChar, 25, "birth_m"))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("birth_y", System.Data.OleDb.OleDbType.VarWChar, 25, "birth_y"))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("city", System.Data.OleDb.OleDbType.VarWChar, 25, "city"))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("civil_status", System.Data.OleDb.OleDbType.VarWChar, 50, "civil_status"))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("country", System.Data.OleDb.OleDbType.VarWChar, 25, "country"))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("email", System.Data.OleDb.OleDbType.VarWChar, 50, "email"))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("father_name", System.Data.OleDb.OleDbType.VarWChar, 50, "father_name"))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("fax", System.Data.OleDb.OleDbType.VarWChar, 30, "fax"))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("first_name", System.Data.OleDb.OleDbType.VarWChar, 50, "first_name"))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("function", System.Data.OleDb.OleDbType.VarWChar, 150, "function"))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("homephone", System.Data.OleDb.OleDbType.VarWChar, 30, "homephone"))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("mobilephone", System.Data.OleDb.OleDbType.VarWChar, 30, "mobilephone"))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("name", System.Data.OleDb.OleDbType.VarWChar, 50, "name"))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("originalfirst_name", System.Data.OleDb.OleDbType.VarWChar, 50, "originalfirst_name"))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Photo", System.Data.OleDb.OleDbType.VarWChar, 255, "Photo"))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("post_office_box", System.Data.OleDb.OleDbType.VarWChar, 25, "post-office_box"))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("sex", System.Data.OleDb.OleDbType.VarWChar, 25, "sex"))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("web", System.Data.OleDb.OleDbType.VarWChar, 50, "web"))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("workphone", System.Data.OleDb.OleDbType.VarWChar, 30, "workphone"))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_bookid", System.Data.OleDb.OleDbType.Integer, 0, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "bookid", System.Data.DataRowVersion.Original, Nothing))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_Photo", System.Data.OleDb.OleDbType.VarWChar, 255, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "Photo", System.Data.DataRowVersion.Original, Nothing))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_Photo1", System.Data.OleDb.OleDbType.VarWChar, 255, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "Photo", System.Data.DataRowVersion.Original, Nothing))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_address1", System.Data.OleDb.OleDbType.VarWChar, 255, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "address1", System.Data.DataRowVersion.Original, Nothing))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_address11", System.Data.OleDb.OleDbType.VarWChar, 255, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "address1", System.Data.DataRowVersion.Original, Nothing))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_address2", System.Data.OleDb.OleDbType.VarWChar, 255, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "address2", System.Data.DataRowVersion.Original, Nothing))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_address21", System.Data.OleDb.OleDbType.VarWChar, 255, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "address2", System.Data.DataRowVersion.Original, Nothing))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_alternativePhone", System.Data.OleDb.OleDbType.VarWChar, 30, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "alternativePhone", System.Data.DataRowVersion.Original, Nothing))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_alternativePhone1", System.Data.OleDb.OleDbType.VarWChar, 30, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "alternativePhone", System.Data.DataRowVersion.Original, Nothing))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_birth", System.Data.OleDb.OleDbType.DBDate, 0, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "birth", System.Data.DataRowVersion.Original, Nothing))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_birth1", System.Data.OleDb.OleDbType.DBDate, 0, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "birth", System.Data.DataRowVersion.Original, Nothing))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_birth_d", System.Data.OleDb.OleDbType.VarWChar, 25, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "birth_d", System.Data.DataRowVersion.Original, Nothing))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_birth_d1", System.Data.OleDb.OleDbType.VarWChar, 25, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "birth_d", System.Data.DataRowVersion.Original, Nothing))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_birth_m", System.Data.OleDb.OleDbType.VarWChar, 25, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "birth_m", System.Data.DataRowVersion.Original, Nothing))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_birth_m1", System.Data.OleDb.OleDbType.VarWChar, 25, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "birth_m", System.Data.DataRowVersion.Original, Nothing))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_birth_y", System.Data.OleDb.OleDbType.VarWChar, 25, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "birth_y", System.Data.DataRowVersion.Original, Nothing))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_birth_y1", System.Data.OleDb.OleDbType.VarWChar, 25, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "birth_y", System.Data.DataRowVersion.Original, Nothing))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_city", System.Data.OleDb.OleDbType.VarWChar, 25, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "city", System.Data.DataRowVersion.Original, Nothing))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_city1", System.Data.OleDb.OleDbType.VarWChar, 25, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "city", System.Data.DataRowVersion.Original, Nothing))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_civil_status", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "civil_status", System.Data.DataRowVersion.Original, Nothing))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_civil_status1", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "civil_status", System.Data.DataRowVersion.Original, Nothing))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_country", System.Data.OleDb.OleDbType.VarWChar, 25, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "country", System.Data.DataRowVersion.Original, Nothing))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_country1", System.Data.OleDb.OleDbType.VarWChar, 25, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "country", System.Data.DataRowVersion.Original, Nothing))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_email", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "email", System.Data.DataRowVersion.Original, Nothing))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_email1", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "email", System.Data.DataRowVersion.Original, Nothing))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_father_name", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "father_name", System.Data.DataRowVersion.Original, Nothing))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_father_name1", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "father_name", System.Data.DataRowVersion.Original, Nothing))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_fax", System.Data.OleDb.OleDbType.VarWChar, 30, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "fax", System.Data.DataRowVersion.Original, Nothing))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_fax1", System.Data.OleDb.OleDbType.VarWChar, 30, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "fax", System.Data.DataRowVersion.Original, Nothing))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_first_name", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "first_name", System.Data.DataRowVersion.Original, Nothing))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_first_name1", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "first_name", System.Data.DataRowVersion.Original, Nothing))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_function", System.Data.OleDb.OleDbType.VarWChar, 150, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "function", System.Data.DataRowVersion.Original, Nothing))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_function1", System.Data.OleDb.OleDbType.VarWChar, 150, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "function", System.Data.DataRowVersion.Original, Nothing))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_homephone", System.Data.OleDb.OleDbType.VarWChar, 30, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "homephone", System.Data.DataRowVersion.Original, Nothing))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_homephone1", System.Data.OleDb.OleDbType.VarWChar, 30, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "homephone", System.Data.DataRowVersion.Original, Nothing))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_mobilephone", System.Data.OleDb.OleDbType.VarWChar, 30, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "mobilephone", System.Data.DataRowVersion.Original, Nothing))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_mobilephone1", System.Data.OleDb.OleDbType.VarWChar, 30, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "mobilephone", System.Data.DataRowVersion.Original, Nothing))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_name", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "name", System.Data.DataRowVersion.Original, Nothing))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_name1", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "name", System.Data.DataRowVersion.Original, Nothing))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_originalfirst_name", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "originalfirst_name", System.Data.DataRowVersion.Original, Nothing))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_originalfirst_name1", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "originalfirst_name", System.Data.DataRowVersion.Original, Nothing))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_post_office_box", System.Data.OleDb.OleDbType.VarWChar, 25, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "post-office_box", System.Data.DataRowVersion.Original, Nothing))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_post_office_box1", System.Data.OleDb.OleDbType.VarWChar, 25, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "post-office_box", System.Data.DataRowVersion.Original, Nothing))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_sex", System.Data.OleDb.OleDbType.VarWChar, 25, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "sex", System.Data.DataRowVersion.Original, Nothing))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_sex1", System.Data.OleDb.OleDbType.VarWChar, 25, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "sex", System.Data.DataRowVersion.Original, Nothing))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_web", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "web", System.Data.DataRowVersion.Original, Nothing))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_web1", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "web", System.Data.DataRowVersion.Original, Nothing))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_workphone", System.Data.OleDb.OleDbType.VarWChar, 30, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "workphone", System.Data.DataRowVersion.Original, Nothing))

OleDbUCommand.Parameters.Add(New System.Data.OleDb.OleDbParameter("Original_workphone1", System.Data.OleDb.OleDbType.VarWChar, 30, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "workphone", System.Data.DataRowVersion.Original, Nothing))

'DataAdapter da, and da.TableMappings

da_Table()

 

End Sub

'DataAdapter da, and da.TableMappings

Private Sub da_Table()

 

'DataAdapter da

da = New OleDb.OleDbDataAdapter(OleDbSCommand)

da.DeleteCommand = OleDbDCommand

da.InsertCommand = OleDbICommand

da.SelectCommand = OleDbSCommand

da.UpdateCommand = OleDbUCommand

da.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "book", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("address1", "address1"), New System.Data.Common.DataColumnMapping("address2", "address2"), New System.Data.Common.DataColumnMapping("alternativePhone", "alternativePhone"), New System.Data.Common.DataColumnMapping("birth", "birth"), New System.Data.Common.DataColumnMapping("birth_d", "birth_d"), New System.Data.Common.DataColumnMapping("birth_m", "birth_m"), New System.Data.Common.DataColumnMapping("birth_y", "birth_y"), New System.Data.Common.DataColumnMapping("bookid", "bookid"), New System.Data.Common.DataColumnMapping("city", "city"), New System.Data.Common.DataColumnMapping("civil_status", "civil_status"), New System.Data.Common.DataColumnMapping("country", "country"), New System.Data.Common.DataColumnMapping("email", "email"), New System.Data.Common.DataColumnMapping("father_name", "father_name"), New System.Data.Common.DataColumnMapping("fax", "fax"), New System.Data.Common.DataColumnMapping("first_name", "first_name"), New System.Data.Common.DataColumnMapping("function", "function"), New System.Data.Common.DataColumnMapping("homephone", "homephone"), New System.Data.Common.DataColumnMapping("mobilephone", "mobilephone"), New System.Data.Common.DataColumnMapping("name", "name"), New System.Data.Common.DataColumnMapping("originalfirst_name", "originalfirst_name"), New System.Data.Common.DataColumnMapping("Photo", "Photo"), New System.Data.Common.DataColumnMapping("post-office_box", "post-office_box"), New System.Data.Common.DataColumnMapping("sex", "sex"), New System.Data.Common.DataColumnMapping("web", "web"), New System.Data.Common.DataColumnMapping("workphone", "workphone")})})

End Sub

 

'load book table, book_dset1 dataset

Public Sub LoadDataSet()

Try

'Attempt to load the dataset.

Me.LoadDataSet1()

Catch eLoad As System.Exception

'Add your error handling code here.

'Display error message, if any.

System.Windows.Forms.MessageBox.Show(eLoad.Message)

End Try

End Sub

Public Sub LoadDataSet1()

'Create a new dataset

Dim objDataSetTemp As work_VBNet_10.book_dset

objDataSetTemp = New work_VBNet_10.book_dset

Try

'Attempt to fill the temporary dataset.

Me.FillDataSet(objDataSetTemp)

Catch eFillDataSet As System.Exception

'Add your error handling code here.

Throw eFillDataSet

End Try

Try

'Empty the old records from the dataset.

book_dset1.Clear()

'Merge the records into the main dataset.

book_dset1.Merge(objDataSetTemp)

Catch eLoadMerge As System.Exception

'Add your error handling code here.

Throw eLoadMerge

End Try

End Sub

 

Public Sub FillDataSet(ByVal dataSet As work_VBNet_10.book_dset)

'Turn off constraint checking before the dataset is filled.

'This allows the adapters to fill the dataset without concern

'for dependencies between the tables.

dataSet.EnforceConstraints = False

Try

'Open the connection.

dbConnection1.Open()

'Attempt to fill the dataset through the da.

da.Fill(dataSet, "book")

Catch fillException As System.Exception

'Add your error handling code here.

Throw fillException

Finally

'Turn constraint checking back on.

dataSet.EnforceConstraints = True

'Close the connection whether or not the exception was thrown.

dbConnection1.Close()

End Try

End Sub

'add data to comboboxes

Private Sub sub_load(ByVal v_field As String)

Dim WhereSearch As String = ""

Dim strSQL As String = ""

Dim i As Integer

 

Select Case v_field

Case "name"

WhereSearch = " WHERE (((Trim(name)) <> ''))"

strSQL = "SELECT DISTINCT Trim(name) AS vname FROM book" & WhereSearch & " ORDER BY Trim(name)"

Case "first"

WhereSearch = " WHERE (((Trim(first_name))<>''))"

strSQL = "SELECT DISTINCT Trim(first_name) AS vfirst FROM book" & WhereSearch & " ORDER BY Trim(first_name)"

Case "father"

WhereSearch = " WHERE (((Trim(father_name)) <>''))"

strSQL = "SELECT DISTINCT Trim(father_name) AS vfather FROM book" & WhereSearch & " ORDER BY Trim(father_name)"

Case "city"

WhereSearch = " WHERE (((Trim(city)) <>''))"

strSQL = "SELECT DISTINCT Trim(city) AS vcity FROM book" & WhereSearch & " ORDER BY Trim(city)"

Case "civil_status"

WhereSearch = " WHERE (((Trim(civil_status)) <>''))"

strSQL = "SELECT DISTINCT Trim(civil_status) AS vcivil FROM book" & WhereSearch & " ORDER BY Trim(civil_status)"

End Select

vselect1 = New OleDb.OleDbCommand(strSQL, dbConnection1) ' Select command

vda1 = New OleDb.OleDbDataAdapter(vselect1) ' Dataadapter

vdset1 = New DataSet

 

'vselect1.Connection() = dbConnection1 ' Select command

vselect1.CommandTimeout = 30

vdset1.EnforceConstraints = False

Try

dbConnection1.Open()

vda1.Fill(vdset1, "book")

Catch fillException As System.Exception

System.Windows.Forms.MessageBox.Show(fillException.Message)

End Try

vdset1.EnforceConstraints = True

dbConnection1.Close()

For i = 0 To vdset1.Tables("book").Rows.Count - 1

Select Case v_field

Case "name"

Me.cmbname.Items.Add(Trim(vdset1.Tables("book").Rows(i).Item("vname")))

Case "first"

Me.cmbfirst_name.Items.Add(Trim(vdset1.Tables("book").Rows(i).Item("vfirst")))

Case "father"

Me.cmbfather_name.Items.Add(Trim(vdset1.Tables("book").Rows(i).Item("vfather")))

Case "city"

Me.cmbcity.Items.Add(Trim(vdset1.Tables("book").Rows(i).Item("vcity")))

Case "civil_status"

Me.cmbcivil_status.Items.Add(Trim(vdset1.Tables("book").Rows(i).Item("vcivil")))

End Select

Next

End Sub

Private Sub book_note_Closed(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Closed

' close form

close_response()

End Sub

Private Sub ToolBar1_ButtonClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles ToolBar1.ButtonClick

Select Case Me.ToolBar1.Buttons.IndexOf(e.Button)

Case 0

' First

NavFirst()

Case 1

' preview

NavPrev()

End Select

End Sub

Private Sub ToolBar2_ButtonClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles ToolBar2.ButtonClick

Select Case Me.ToolBar2.Buttons.IndexOf(e.Button)

Case 0

' next

NavNext()

Case 1

' last

NavLast()

End Select

End Sub

Private Sub ToolBar3_ButtonClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles ToolBar3.ButtonClick

Select Case Me.ToolBar3.Buttons.IndexOf(e.Button)

Case 0

Me.lboperation.Text = "add operation"

'clear comboboxes

clearcombo()

sub_load("name")

sub_load("first")

sub_load("father")

sub_load("city")

sub_load("civil_status")

'edit control readonly

edit_read(False)

' add

sub_add()

Me.Pic_photo.Image = Nothing

End Select

End Sub

Private Sub ToolBar4_ButtonClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles ToolBar4.ButtonClick

Select Case Me.ToolBar4.Buttons.IndexOf(e.Button)

Case 0

Me.lboperation.Text = "modify operation"

'edit control readonly

edit_read(False)

' modify

sub_modify()

End Select

End Sub

Private Sub ToolBar5_ButtonClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles ToolBar5.ButtonClick

Select Case Me.ToolBar5.Buttons.IndexOf(e.Button)

Case 0

Me.lboperation.Text = "save operation"

' save

sub_Update()

End Select

End Sub

Private Sub ToolBar6_ButtonClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles ToolBar6.ButtonClick

Select Case Me.ToolBar6.Buttons.IndexOf(e.Button)

Case 0

Me.lboperation.Text = "cancel operation"

' cancel

sub_Cancel()

End Select

End Sub

Private Sub ToolBar10_ButtonClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles ToolBar10.ButtonClick

Select Case Me.ToolBar10.Buttons.IndexOf(e.Button)

Case 0

Me.lboperation.Text = "search operation"

' search

sub_find()

End Select

End Sub

Private Sub ToolBar8_ButtonClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles ToolBar8.ButtonClick

Select Case Me.ToolBar8.Buttons.IndexOf(e.Button)

Case 0

Me.lboperation.Text = "print operation"

' print

sub_print()

End Select

End Sub

Private Sub ToolBar9_ButtonClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles ToolBar9.ButtonClick

Select Case Me.ToolBar9.Buttons.IndexOf(e.Button)

Case 0

Me.lboperation.Text = "close operation"

' close form

close_response()

End Select

End Sub

Private Sub close_response()

Dim response As MsgBoxResult

Dim msg_inf As String

If (mbaddflag Or mbeditflag) Then

msg_inf = "are you sure want to lose all changes, book note ..."

response = MsgBox(msg_inf, MsgBoxStyle.DefaultButton2 Or MsgBoxStyle.Information Or MsgBoxStyle.YesNo, Title)

'Gets the result of the MessageBox display.

If (response = MsgBoxResult.Yes) Then

mbaddflag = False

mbeditflag = False

Me.Close()

End If

 

Else

Me.Close()

End If

End Sub

'navigation operation ... *****************************

Private Sub NavFirst()

mbaddflag = False

mbeditflag = False

Me.BindingContext(book_dset1, "book").Position = 0

Me.book_dset1_PositionChanged()

 

End Sub

Private Sub book_dset1_PositionChanged()

 

Me.editbirth.Text = Str(Me.DateTime_birth.Value.Month) & "/" & Str(Me.DateTime_birth.Value.Day) & "/" & Str(Me.DateTime_birth.Value.Year)

Me.lblNavLocation.Text = "record : " + (((Me.BindingContext(book_dset1, "book").Position + 1).ToString + " of ") _

+ Me.BindingContext(book_dset1, "book").Count.ToString)

Select Case mbaddflag Or mbeditflag

Case False

Me.lboperation.Text = "navigation operation"

visible_control(False)

' Navigation controls enebled(True or False

If Me.BindingContext(book_dset1, "book").Position + 1 = 1 Then

NavigationFP(False)

NavigationNL(True)

GoTo PP1

ElseIf Me.BindingContext(book_dset1, "book").Position + 1 = Me.BindingContext(book_dset1, "book").Count Then

NavigationFP(True)

NavigationNL(False)

GoTo PP1

Else

NavigationFP(True)

NavigationNL(True)

End If

PP1:

Enabled_AMS(True)

Enabled_CFP(True)

'edit control readonly

edit_read(True)

 

Case True

If mbaddflag = True Then lboperation.Text = "add operation"

If mbeditflag = True Then Me.lboperation.Text = "mudify operation"

visible_control(True)

NavigationFP(False)

NavigationNL(False)

Enabled_AMS(False)

Enabled_CFP(False)

'edit control readonly

edit_read(False)

End Select

'show photo

sub_showphoto()

Me.lblNavLocation.Focus()

 

End Sub

'edit control readonly

Private Sub edit_read(ByVal bval As Boolean)

 

Me.editname.ReadOnly = bval

Me.editfirst_name.ReadOnly = bval

Me.editfather_name.ReadOnly = bval

Me.editbirth.ReadOnly = bval

Me.editcivil_status.ReadOnly = bval

Me.editsex.ReadOnly = bval

Me.editcountry.ReadOnly = bval

Me.editcity.ReadOnly = bval

Me.editcivil_status.ReadOnly = bval

Me.editfunction.ReadOnly = bval

Me.editaddress1.ReadOnly = bval

Me.editaddress2.ReadOnly = bval

Me.editpost_office_box.ReadOnly = bval

Me.edithomephone.ReadOnly = bval

Me.editworkphone.ReadOnly = bval

Me.editmobilephone.ReadOnly = bval

Me.editalternativePhone.ReadOnly = bval

Me.editfax.ReadOnly = bval

Me.editweb.ReadOnly = bval

Me.editemail.ReadOnly = bval

Me.Btnphoto_new.Enabled = Not bval

Me.Btnphoto_del.Enabled = Not bval

End Sub

 

Private Sub visible_control(ByVal bval As Boolean)

Me.cmbname.Visible = bval

Me.cmbfirst_name.Visible = bval

Me.cmbfather_name.Visible = bval

Me.DateTime_birth.Visible = bval

Me.cmbsex.Visible = bval

Me.cmbcivil_status.Visible = bval

Me.cmbcountry.Visible = bval

Me.cmbcity.Visible = bval

Me.editname.Visible = Not bval

Me.editfirst_name.Visible = Not bval

Me.editfather_name.Visible = Not bval

Me.editbirth.Visible = Not bval

Me.editcivil_status.Visible = Not bval

Me.editsex.Visible = Not bval

Me.editcountry.Visible = Not bval

Me.editcity.Visible = Not bval

Me.editname.Left = Me.cmbname.Left

Me.editname.Width = Me.cmbname.Width

Me.editname.Top = Me.cmbname.Top

Me.editfirst_name.Left = Me.cmbfirst_name.Left

Me.editfirst_name.Width = Me.cmbfirst_name.Width

Me.editfirst_name.Top = Me.cmbfirst_name.Top

Me.editfather_name.Left = Me.cmbfather_name.Left

Me.editfather_name.Width = Me.cmbfather_name.Width

Me.editfather_name.Top = Me.cmbfather_name.Top

Me.editbirth.Left = Me.DateTime_birth.Left

Me.editbirth.Width = Me.DateTime_birth.Width

Me.editbirth.Top = Me.DateTime_birth.Top

Me.editsex.Left = Me.cmbsex.Left

Me.editsex.Width = Me.cmbsex.Width

Me.editsex.Top = Me.cmbsex.Top

Me.editcivil_status.Left = Me.cmbcivil_status.Left

Me.editcivil_status.Width = Me.cmbcivil_status.Width

Me.editcivil_status.Top = Me.cmbcivil_status.Top

Me.editcountry.Left = Me.cmbcountry.Left

Me.editcountry.Width = Me.cmbcountry.Width

Me.editcountry.Top = Me.cmbcountry.Top

Me.editcity.Left = Me.cmbcity.Left

Me.editcity.Width = Me.cmbcity.Width

Me.editcity.Top = Me.cmbcity.Top

End Sub

' Enabled the controls

Private Sub NavigationFP(ByVal bval As Boolean)

Me.ToolBarfirst.Enabled = bval

Me.ToolBarpreview.Enabled = bval

End Sub

' Enabled the controls

Private Sub NavigationNL(ByVal bval As Boolean)

Me.ToolBarnext.Enabled = bval

Me.ToolBarlast.Enabled = bval

End Sub

'Toolbar items enabled .

Private Sub Enabled_AMS(ByVal bval As Boolean)

Me.ToolBaradd.Enabled = bval

Me.ToolBarmodify.Enabled = bval

Me.ToolBarsave.Enabled = Not bval

Me.ToolBarcancel.Enabled = Not bval

Me.lblNavLocation.Enabled = bval

End Sub

'Toolbar items enabled .

Private Sub Enabled_CFP(ByVal bval As Boolean)

' Me.ToolBarsearch.Enabled = bval

Me.ToolBarprint.Enabled = bval

End Sub

'show photo

Private Sub sub_showphoto()

If (mbaddflag = False) Then

If Me.editphoto_photo.Text.Trim <> "" Then

If System.IO.File.Exists(Me.editphoto_photo.Text.Trim) = True Then

Me.Panel_photo.BorderStyle = BorderStyle.None

Me.Pic_photo.Image = Image.FromFile(Me.editphoto_photo.Text.Trim)

Me.Pic_photo.Left = (Me.Panel_photo.Width - Me.Pic_photo.Width) / 2

Me.Pic_photo.Top = (Me.Panel_photo.Height - Me.Pic_photo.Height) / 2

Me.Btnphoto_del.Enabled = False

Me.Btnphoto_new.Enabled = False

If mbeditflag = True Then

Me.Btnphoto_del.Enabled = True

Me.Btnphoto_new.Enabled = True

End If

Else

GoTo pt

End If

Else

pt:

Me.Pic_photo.Image = Nothing

Me.Panel_photo.BorderStyle = BorderStyle.FixedSingle

If mbeditflag = True Then

Me.Btnphoto_new.Enabled = True

Else

Me.Btnphoto_new.Enabled = False

End If

Me.Btnphoto_del.Enabled = False

End If

End If

End Sub

Private Sub NavPrev()

mbaddflag = False

mbeditflag = False

Me.BindingContext(book_dset1, "book").Position = (Me.BindingContext(book_dset1, "book").Position - 1)

Me.book_dset1_PositionChanged()

End Sub

Private Sub NavNext()

mbaddflag = False

mbeditflag = False

Me.BindingContext(book_dset1, "book").Position = (Me.BindingContext(book_dset1, "book").Position + 1)

Me.book_dset1_PositionChanged()

End Sub

Private Sub NavLast()

mbaddflag = False

mbeditflag = False

Me.BindingContext(book_dset1, "book").Position = (Me.book_dset1.Tables("book").Rows.Count - 1)

Me.book_dset1_PositionChanged()

End Sub

Private Sub sub_add()

Me.cmbname.SelectedIndex = -1

Me.cmbfirst_name.SelectedIndex = -1

Me.cmbfather_name.SelectedIndex = -1

Me.cmbsex.SelectedIndex = -1

Me.cmbcivil_status.SelectedIndex = -1

Me.cmbcountry.SelectedIndex = -1

Me.cmbcity.SelectedIndex = -1

Me.cmbname.Text = ""

Me.cmbfirst_name.Text = ""

Me.cmbfather_name.Text = ""

Me.cmbsex.Text = ""

Me.cmbcivil_status.Text = ""

Me.cmbcountry.Text = ""

Me.cmbcity.Text = ""

Try

'Clear out the current edits

Me.BindingContext(book_dset1, "book").EndCurrentEdit()

Me.BindingContext(book_dset1, "book").AddNew()

mbaddflag = True

 

Catch eEndEdit As System.Exception

System.Windows.Forms.MessageBox.Show(eEndEdit.Message)

End Try

'show photo ...

Me.Btnphoto_del.Enabled = False

Me.Btnphoto_new.Enabled = True

 

Me.book_dset1_PositionChanged()

Me.cmbname.Focus()

End Sub

'--->

'show photo, add or remove/delete photo '''''''''''''''''''''

Private Sub Btnphoto_new_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Btnphoto_new.Click

If mbaddflag = True Or mbeditflag = True Then

'OpenFileDialog control, displays the Photo corresponding and save it ...

sub_addphoto()

End If

End Sub

'OpenFileDialog control, displays the Photo corresponding and save it ...

Private Sub sub_addphoto()

Dim vfilename As String

Me.OpenFileDialog1.Title = "Book note, Select Picture"

Me.OpenFileDialog1.Filter = "All Files|*.*|JPeg Image|*.jpg|Bitmap Image|*.bmp|Gif Image|*.gif"

Me.OpenFileDialog1.FilterIndex = 3

' Show the Dialog, if the user clicked in the dialog and a picture file was selected, open it.

If OpenFileDialog1.ShowDialog() = DialogResult.OK Then

'add record to table per_appphoto

vfilename = OpenFileDialog1.FileName

Me.Panel_photo.BorderStyle = BorderStyle.None

Me.Pic_photo.Image = Image.FromFile(OpenFileDialog1.FileName)

Me.Pic_photo.Left = (Me.Panel_photo.Width - Me.Pic_photo.Width) / 2

Me.Pic_photo.Top = (Me.Panel_photo.Height - Me.Pic_photo.Height) / 2

Me.editphoto_photo.Text = vfilename

Me.Btnphoto_del.Enabled = True

End If

End Sub

Private Sub Btnphoto_del_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Btnphoto_del.Click

If mbaddflag = True Or mbeditflag = True Then

' remove/delete photo and clear the file photo name corresponding

sub_removephoto()

End If

End Sub

' remove/delete photo and clear the file photo name corresponding

Private Sub sub_removephoto()

Dim response As MsgBoxResult

Dim msg_inf As String

 

msg_inf = "are you sure want to remove the photo of - " + Me.editfirst_name.Text + " " + Me.editname.Text

response = MsgBox(msg_inf, MsgBoxStyle.DefaultButton2 Or MsgBoxStyle.Information Or MsgBoxStyle.YesNo, Title)

'Gets the result of the MessageBox display.

If (response = MsgBoxResult.Yes) Then

'clear photo ...

Me.Panel_photo.BorderStyle = BorderStyle.FixedSingle

Pic_photo.Image.Dispose()

Pic_photo.Image = Nothing

Me.editphoto_photo.Text = ""

Me.Btnphoto_del.Enabled = False

Exit Sub

End If

If (response = MsgBoxResult.No) Then

Exit Sub

End If

End Sub

'<---

Private Sub sub_modify()

booknote_type = "edit"

mbeditflag = True

sub_Searchedit()

fbook_search.ShowDialog()

End Sub

Private Sub sub_Searchedit()

NavigationFP(False)

NavigationNL(False)

Enabled_AMS(False)

Enabled_CFP(False)

Me.ToolBarsave.Enabled = False

Me.ToolBarcancel.Enabled = False

End Sub

Public Sub sub_modifyok()

Me.BindingContext(book_dset1, "book").Position = book_recno

Me.book_dset1_PositionChanged()

Me.cmbname.Text = Me.editname.Text

Me.cmbfirst_name.Text = Me.editfirst_name.Text

Me.cmbfather_name.Text = Me.editfather_name.Text

Me.DateTime_birth.Text = Me.editbirth.Text

Me.cmbsex.Text = Me.editsex.Text

Me.cmbcivil_status.Text = Me.editcivil_status.Text

Me.cmbcountry.Text = Me.editcountry.Text

Me.cmbcity.Text = Me.editcity.Text

End Sub

Public Sub Searchedit_cancel()

mbeditflag = False

book_dset1_PositionChanged()

End Sub

 

Private Sub sub_Update()

Dim response As MsgBoxResult

'convert, comboboxes to textboxes

Me.editname.Text = Me.cmbname.Text

Me.editfirst_name.Text = Me.cmbfirst_name.Text

Me.editfather_name.Text = Me.cmbfather_name.Text

Me.editbirth.Text = Me.DateTime_birth.Text

Me.editsex.Text = Me.cmbsex.Text

Me.editcivil_status.Text = Me.cmbcivil_status.Text

Me.editcountry.Text = Me.cmbcountry.Text

Me.editcity.Text = Me.cmbcity.Text

' Me.editoriginalfirst_name.Text = Me.cmbfirst_name.Text

 

If (mbeditflag Or mbaddflag) Then

If ((Me.editname.Text = "") Or (Me.editfirst_name.Text = "") Or (Me.editfather_name.Text = "")) Then

response = MsgBox("save operation aborted - name box, first name box or father name box empty(ies) ...", MsgBoxStyle.DefaultButton2 Or MsgBoxStyle.Information Or MsgBoxStyle.YesNo, Title)

If (response = MsgBoxResult.Yes) Then Exit Sub

If (response = MsgBoxResult.No) Then sub_Cancel()

Exit Sub

Else

sub_updateok(Trim(Me.editname.Text), Trim(Me.editfirst_name.Text), Trim(Me.editfather_name.Text))

If mbaddflag Then mbaddflag = False

If mbeditflag Then mbeditflag = False

Me.editoriginalfirst_name.Text = Me.cmbfirst_name.Text

vbirth_d = Me.DateTime_birth.Value.Day.ToString

vbirth_m = Me.DateTime_birth.Value.Month.ToString

vbirth_y = Me.DateTime_birth.Value.Year.ToString

Me.editbirth_d.Text = vbirth_d

Me.editbirth_m.Text = vbirth_m

Me.editbirth_y.Text = vbirth_y

 

'Attempt to update the datasource.

Me.UpdateDataSet()

Me.book_dset1_PositionChanged()

End If

End If

End Sub

'add data to comboboxes

Private Sub sub_updateok(ByVal v_name As String, ByVal v_first As String, ByVal v_father As String)

Dim WhereSearch As String = ""

Dim v_ord As Integer

WhereSearch = " WHERE ((name = '" & v_name & "') And (originalfirst_name = '" & v_first & "') And (father_name = '" & v_father & "'))"

vselect1 = New OleDb.OleDbCommand("SELECT bookid, name, first_name, originalfirst_name, father_name FROM book" & WhereSearch & " ORDER BY bookid")

vda1 = New OleDb.OleDbDataAdapter(vselect1)

vdset1 = New DataSet

vselect1.Connection() = dbConnection1 ' Select command

vselect1.CommandTimeout = 30

vdset1.EnforceConstraints = False

Try

dbConnection1.Open()

vda1.Fill(vdset1, "book")

Catch fillException As System.Exception

System.Windows.Forms.MessageBox.Show(fillException.Message)

End Try

vdset1.EnforceConstraints = True

dbConnection1.Close()

If vdset1.Tables("book").Rows.Count() > 0 Then

v_ord = vdset1.Tables("book").Rows.Count() - 1

Me.editfirst_name.Text = Trim(Me.editoriginalfirst_name.Text) & Trim(Str(v_ord))

End If

End Sub

 

Public Sub UpdateDataSet()

'Create a new dataset to hold the changes that have been made to the main dataset.

Dim objDataSetChanges As work_VBNet_10.book_dset = New work_VBNet_10.book_dset

'Stop any current edits.

Me.BindingContext(book_dset1, "book").EndCurrentEdit()

'Get the changes that have been made to the main dataset.

objDataSetChanges = CType(book_dset1.GetChanges, work_VBNet_10.book_dset)

'Check to see if any changes have been made.

If (Not (objDataSetChanges) Is Nothing) Then

Try

'There are changes that need to be made, so attempt to update the datasource by

'calling the update method and passing the dataset and any parameters.

Me.UpdateDataSource(objDataSetChanges)

book_dset1.Merge(objDataSetChanges)

book_dset1.AcceptChanges()

Catch eUpdate As System.Exception

'Add your error handling code here.

Throw eUpdate

End Try

'Add your code to check the returned dataset for any errors that may have been

'pushed into the row object's error.

End If

End Sub

Public Sub UpdateDataSource(ByVal ChangedRows As work_VBNet_10.book_dset)

'DataAdapter da, and da.TableMappings

da_Table()

Try

'The data source only needs to be updated if there are changes pending.

If (Not (ChangedRows) Is Nothing) Then

'Open the connection.

dbConnection1.Open()

'Attempt to update the data source.

da.Update(ChangedRows, "book")

End If

Catch updateException As System.Exception

'Add your error handling code here.

Throw updateException

Finally

'Close the connection whether or not the exception was thrown.

dbConnection1.Close()

End Try

End Sub

Private Sub sub_Cancel()

If mbaddflag Then mbaddflag = False

If mbeditflag Then mbeditflag = False

Me.book_dset1.RejectChanges()

Me.BindingContext(book_dset1, "book").CancelCurrentEdit()

Me.book_dset1_PositionChanged()

 

End Sub

 

Private Sub sub_find()

booknote_type = "find"

sub_Searchedit()

fbook_search.ShowDialog()

End Sub

 

Public Sub sub_findok()

Me.BindingContext(book_dset1, "book").Position = book_recno

Me.book_dset1_PositionChanged()

Me.lboperation.Text = "search operation"

End Sub

 

Private Sub sub_print()

' Me.book_dset1_PositionChanged()

End Sub

 

 

Private Sub editbirth_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles editbirth.TextChanged

End Sub

End Class

   
  
 



 

      Return