EDN Admin
Well-known member
Hi,
Im trying to delete all records from a table (that exists in FoxPro) that contain a certain market number. THe market number is being typed into a textbox by the user.
Im pasting the code below, if someone could please take a look and tell me what Im doing wrong I would really appreciate it.
As it is right now, Im not recieving any errors. It seems to be running fine, but when I open the table after running it, nothing is deleted. Im not sure what Im missing
<pre class="prettyprint lang-vb Dim connStr = "Provider=vfpoledb;Data Source=C:"
Dim conn = New OleDbConnection(connStr)
Dim cmd As New OleDbCommand()
cmd.Connection = conn
cmd.CommandType = System.Data.CommandType.Text
cmd.CommandText = "DELETE FROM c:mytable WHERE market=?"
cmd.Parameters.AddWithValue("?", TextBox1.Text)
conn.Open()
cmd.ExecuteNonQuery()
conn.close()
MsgBox("delete complete")[/code]
<br/><hr class="sig -Joni
View the full article
Im trying to delete all records from a table (that exists in FoxPro) that contain a certain market number. THe market number is being typed into a textbox by the user.
Im pasting the code below, if someone could please take a look and tell me what Im doing wrong I would really appreciate it.
As it is right now, Im not recieving any errors. It seems to be running fine, but when I open the table after running it, nothing is deleted. Im not sure what Im missing

<pre class="prettyprint lang-vb Dim connStr = "Provider=vfpoledb;Data Source=C:"
Dim conn = New OleDbConnection(connStr)
Dim cmd As New OleDbCommand()
cmd.Connection = conn
cmd.CommandType = System.Data.CommandType.Text
cmd.CommandText = "DELETE FROM c:mytable WHERE market=?"
cmd.Parameters.AddWithValue("?", TextBox1.Text)
conn.Open()
cmd.ExecuteNonQuery()
conn.close()
MsgBox("delete complete")[/code]
<br/><hr class="sig -Joni

View the full article