T
the_grove_man
I am writing an application that populates a database from text files.
I have an insert command which works fine, however, it overwrites
anything that was in the database before.
Looking for a little help: (the database starts off empty)
Here is my code:
Dim x As Integer = rtf4.Find("<sdr_string>")
Dim y As Integer = rtf4.Find("</sdr_string>")
Try
rtf4.Select(x + 4, ((y - 1) - (x + 4)) + 10)
rtf4.ScrollToCaret()
rtf4.Focus()
rtf4.Cut()
Dim j As String = Clipboard.GetText.Trim.ToString
Dim t As String = j.Substring(8, j.Length - 17).Trim
Dim command As String
command = "INSERT into ParentChild(signal, FileName, Sheet)
values('" & t & "','" & My.Forms.Form1.Title.Replace(".edit", "") &
"','" & My.Forms.Form1.Title.Substring(My.Forms.Form1.Title.Length - 8,
3) & "'" & ")"
If cn.State = ConnectionState.Closed Then
cn.Open()
End If
Dim cmd As New OleDb.OleDbCommand(command, cn)
cmd.CommandType = CommandType.Text
cmd.ExecuteNonQuery()
cn.Close()
Button2.PerformClick()
Catch ex As Exception
If MessageBox.Show("Database has been prepped", "Database
Entries", MessageBoxButtons.OK, MessageBoxIcon.Information) =
Windows.Forms.DialogResult.OK Then
Me.Close()
End If
Exit Sub
End Try
I have an insert command which works fine, however, it overwrites
anything that was in the database before.
Looking for a little help: (the database starts off empty)
Here is my code:
Dim x As Integer = rtf4.Find("<sdr_string>")
Dim y As Integer = rtf4.Find("</sdr_string>")
Try
rtf4.Select(x + 4, ((y - 1) - (x + 4)) + 10)
rtf4.ScrollToCaret()
rtf4.Focus()
rtf4.Cut()
Dim j As String = Clipboard.GetText.Trim.ToString
Dim t As String = j.Substring(8, j.Length - 17).Trim
Dim command As String
command = "INSERT into ParentChild(signal, FileName, Sheet)
values('" & t & "','" & My.Forms.Form1.Title.Replace(".edit", "") &
"','" & My.Forms.Form1.Title.Substring(My.Forms.Form1.Title.Length - 8,
3) & "'" & ")"
If cn.State = ConnectionState.Closed Then
cn.Open()
End If
Dim cmd As New OleDb.OleDbCommand(command, cn)
cmd.CommandType = CommandType.Text
cmd.ExecuteNonQuery()
cn.Close()
Button2.PerformClick()
Catch ex As Exception
If MessageBox.Show("Database has been prepped", "Database
Entries", MessageBoxButtons.OK, MessageBoxIcon.Information) =
Windows.Forms.DialogResult.OK Then
Me.Close()
End If
Exit Sub
End Try