TexG
Well-known member
Hello All,
Makeing a database where i want the primary key to be a word.
how do i check for duplicate in database or how to handle them error code wise?
any ideals
thanks
[VB]
Dim MyConnection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
IO.Path.GetDirectoryName(Application.ExecutablePath) & "\DataBase\" & _
NameofDB)
MyConnection.Open()
Dim MyCommand As New OleDbCommand("INSERT INTO Cable " & _
"(Jack_Name, Jack_Location, IDF_Location, Patch_Panel_Number," & _
"Port_Number, Cable_Type, Assigned_Port_on_Switch, Assigned_Vlan) VALUES " & _
"(" & MainClass.ADDNewLineDB.TextBox1.Text & ", " & MainClass.ADDNewLineDB.TextBox2.Text & "," & _
"" & MainClass.ADDNewLineDB.TextBox3.Text & ", " & MainClass.ADDNewLineDB.TextBox4.Text & "," & _
"" & MainClass.ADDNewLineDB.TextBox5.Text & ", " & MainClass.ADDNewLineDB.TextBox6.Text & "," & _
"" & MainClass.ADDNewLineDB.TextBox7.Text & ", " & MainClass.ADDNewLineDB.TextBox8.Text & ")", MyConnection)
MyCommand.ExecuteNonQuery()
MyConnection.Close()
MyCommand.Dispose()
[/VB]
Makeing a database where i want the primary key to be a word.
how do i check for duplicate in database or how to handle them error code wise?
any ideals
thanks
[VB]
Dim MyConnection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
IO.Path.GetDirectoryName(Application.ExecutablePath) & "\DataBase\" & _
NameofDB)
MyConnection.Open()
Dim MyCommand As New OleDbCommand("INSERT INTO Cable " & _
"(Jack_Name, Jack_Location, IDF_Location, Patch_Panel_Number," & _
"Port_Number, Cable_Type, Assigned_Port_on_Switch, Assigned_Vlan) VALUES " & _
"(" & MainClass.ADDNewLineDB.TextBox1.Text & ", " & MainClass.ADDNewLineDB.TextBox2.Text & "," & _
"" & MainClass.ADDNewLineDB.TextBox3.Text & ", " & MainClass.ADDNewLineDB.TextBox4.Text & "," & _
"" & MainClass.ADDNewLineDB.TextBox5.Text & ", " & MainClass.ADDNewLineDB.TextBox6.Text & "," & _
"" & MainClass.ADDNewLineDB.TextBox7.Text & ", " & MainClass.ADDNewLineDB.TextBox8.Text & ")", MyConnection)
MyCommand.ExecuteNonQuery()
MyConnection.Close()
MyCommand.Dispose()
[/VB]