Delete SQL statement not functioning
I receive “Syntax Error in FROM clause”
Any help/ideas are greatly appreciated, I’m a beginner if you can’t tell!
CODE is as follows:
Private Sub cmdDelete_click()
Dim sql As String, rCount As Integer
If me.dirty then
Me.dirty = False
End if
Set dbs = currentdb
SQL = “DELETE Item FROM item = ‘“ & me.txtItem & “‘“ & “WHERE ID=“ & me.txtID2
Dbs.Execute sql, dbFailOnError
rCount = dbs.RecordsAffected
If rCount >0 then
Msgbox “The item List has been updated”
List40.Requery
Clear
End if
End sub
sql ms-access
|
show 1 more comment
I receive “Syntax Error in FROM clause”
Any help/ideas are greatly appreciated, I’m a beginner if you can’t tell!
CODE is as follows:
Private Sub cmdDelete_click()
Dim sql As String, rCount As Integer
If me.dirty then
Me.dirty = False
End if
Set dbs = currentdb
SQL = “DELETE Item FROM item = ‘“ & me.txtItem & “‘“ & “WHERE ID=“ & me.txtID2
Dbs.Execute sql, dbFailOnError
rCount = dbs.RecordsAffected
If rCount >0 then
Msgbox “The item List has been updated”
List40.Requery
Clear
End if
End sub
sql ms-access
3
Please don't build up SQL queries via string concatenation. That leads to SQL Injection.
– Damien_The_Unbeliever
Nov 21 '18 at 9:15
What is the name of the table you are trying to delete from? How would you identify the row(s) to delete (column name and type, value)?
– Hans Kesting
Nov 21 '18 at 9:40
The table is "Item" and the .field is Item the field consists of auto parts
– skooter
Nov 21 '18 at 9:40
After double click "listbox" info is placed in textbox "txtItem" and Id is placed in txtID2
– skooter
Nov 21 '18 at 9:41
sorry yes ms-access
– skooter
Nov 21 '18 at 9:43
|
show 1 more comment
I receive “Syntax Error in FROM clause”
Any help/ideas are greatly appreciated, I’m a beginner if you can’t tell!
CODE is as follows:
Private Sub cmdDelete_click()
Dim sql As String, rCount As Integer
If me.dirty then
Me.dirty = False
End if
Set dbs = currentdb
SQL = “DELETE Item FROM item = ‘“ & me.txtItem & “‘“ & “WHERE ID=“ & me.txtID2
Dbs.Execute sql, dbFailOnError
rCount = dbs.RecordsAffected
If rCount >0 then
Msgbox “The item List has been updated”
List40.Requery
Clear
End if
End sub
sql ms-access
I receive “Syntax Error in FROM clause”
Any help/ideas are greatly appreciated, I’m a beginner if you can’t tell!
CODE is as follows:
Private Sub cmdDelete_click()
Dim sql As String, rCount As Integer
If me.dirty then
Me.dirty = False
End if
Set dbs = currentdb
SQL = “DELETE Item FROM item = ‘“ & me.txtItem & “‘“ & “WHERE ID=“ & me.txtID2
Dbs.Execute sql, dbFailOnError
rCount = dbs.RecordsAffected
If rCount >0 then
Msgbox “The item List has been updated”
List40.Requery
Clear
End if
End sub
sql ms-access
sql ms-access
edited Nov 21 '18 at 9:44
Damien_The_Unbeliever
192k17245331
192k17245331
asked Nov 21 '18 at 8:34
skooterskooter
11
11
3
Please don't build up SQL queries via string concatenation. That leads to SQL Injection.
– Damien_The_Unbeliever
Nov 21 '18 at 9:15
What is the name of the table you are trying to delete from? How would you identify the row(s) to delete (column name and type, value)?
– Hans Kesting
Nov 21 '18 at 9:40
The table is "Item" and the .field is Item the field consists of auto parts
– skooter
Nov 21 '18 at 9:40
After double click "listbox" info is placed in textbox "txtItem" and Id is placed in txtID2
– skooter
Nov 21 '18 at 9:41
sorry yes ms-access
– skooter
Nov 21 '18 at 9:43
|
show 1 more comment
3
Please don't build up SQL queries via string concatenation. That leads to SQL Injection.
– Damien_The_Unbeliever
Nov 21 '18 at 9:15
What is the name of the table you are trying to delete from? How would you identify the row(s) to delete (column name and type, value)?
– Hans Kesting
Nov 21 '18 at 9:40
The table is "Item" and the .field is Item the field consists of auto parts
– skooter
Nov 21 '18 at 9:40
After double click "listbox" info is placed in textbox "txtItem" and Id is placed in txtID2
– skooter
Nov 21 '18 at 9:41
sorry yes ms-access
– skooter
Nov 21 '18 at 9:43
3
3
Please don't build up SQL queries via string concatenation. That leads to SQL Injection.
– Damien_The_Unbeliever
Nov 21 '18 at 9:15
Please don't build up SQL queries via string concatenation. That leads to SQL Injection.
– Damien_The_Unbeliever
Nov 21 '18 at 9:15
What is the name of the table you are trying to delete from? How would you identify the row(s) to delete (column name and type, value)?
– Hans Kesting
Nov 21 '18 at 9:40
What is the name of the table you are trying to delete from? How would you identify the row(s) to delete (column name and type, value)?
– Hans Kesting
Nov 21 '18 at 9:40
The table is "Item" and the .field is Item the field consists of auto parts
– skooter
Nov 21 '18 at 9:40
The table is "Item" and the .field is Item the field consists of auto parts
– skooter
Nov 21 '18 at 9:40
After double click "listbox" info is placed in textbox "txtItem" and Id is placed in txtID2
– skooter
Nov 21 '18 at 9:41
After double click "listbox" info is placed in textbox "txtItem" and Id is placed in txtID2
– skooter
Nov 21 '18 at 9:41
sorry yes ms-access
– skooter
Nov 21 '18 at 9:43
sorry yes ms-access
– skooter
Nov 21 '18 at 9:43
|
show 1 more comment
3 Answers
3
active
oldest
votes
FROM
must refer to a table (whether a physical table you've built, a stored query, or the result of an embedded SQL string).FROM item = ‘“ & me.txtItem & “‘“
in your code has no meaning to SQL.
This avoids the string concatenation to build up your SQL - just pass the value as a parameter and then execute the query:
Private Sub cmdDelete_Click()
Dim qdf As DAO.QueryDef
Set qdf = CurrentDb.CreateQueryDef("", _
"PARAMETERS Identifier TEXT (255); " & _
"DELETE * FROM Table1 WHERE ID = Identifier")
With qdf
.Parameters("Identifier") = Me.txtID2
.Execute
End With
End Sub
When I use this i received the following: Runtime Error (3464) Datatype Mismatch in criteria expression.
– skooter
Nov 21 '18 at 19:30
Sorry, misread the SQL in your question.ID
is a numeric field so replaceTEXT (255)
withLong
.
– Darren Bartrup-Cook
Nov 22 '18 at 9:15
add a comment |
You can simply use DELETE in SQL like this.
DELETE FROM Item WHERE ID='" + txtID2.Text + "'
Where you can delete an item base on the items ID.
You can assign the value of you ID to a parameter like this.SqlCmd.Parameters.AddWithValue("@ID", txtID2.Text)
then the query will call the value of the ID.
– Unknown
Nov 21 '18 at 9:06
When I change the sql statement as both of you suggested, it still doesn’t function.
– skooter
Nov 21 '18 at 9:20
@skooter "doesn't function" does not say much. Do you get any errors? Please specify.
– Hans Kesting
Nov 21 '18 at 9:36
@Unknown Be careful with AddWithValue
– Hans Kesting
Nov 21 '18 at 9:37
Immediately it says "Expected: = " so I put SQL = CMD.....
– skooter
Nov 21 '18 at 9:39
|
show 3 more comments
I have Read your Question the Error in the Your SQL QUERY Try This:
SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText ="DELETE FROM Item WHERE ID='"+txtyoutextbox.Text.Trim()+"';
cmd.ExecuteNonQuery();
With this the code doesn’t do anything
– skooter
Nov 21 '18 at 9:23
How should it read:
– skooter
Nov 21 '18 at 9:35
I'm trying to create a userform with ability to delete from unbound textbox with ID textbox associated. What is best way?
– skooter
Nov 21 '18 at 9:36
you can get textboxbox value and store into int variable int id=Convert.ToInt32(txtyourtextboxname.text); THen Fire the Query Like DELETE FROM Item WHERE ID='"+id+" OR DELETE FROM Item WHERE ID='"+Convert.ToInt32(txtyourtextboxname.text.Trim())+";
– Dipak Rathod
Nov 21 '18 at 10:37
You can use Sqlcommand For That And Command Type=Text
– Dipak Rathod
Nov 21 '18 at 10:41
|
show 5 more comments
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53408014%2fdelete-sql-statement-not-functioning%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
FROM
must refer to a table (whether a physical table you've built, a stored query, or the result of an embedded SQL string).FROM item = ‘“ & me.txtItem & “‘“
in your code has no meaning to SQL.
This avoids the string concatenation to build up your SQL - just pass the value as a parameter and then execute the query:
Private Sub cmdDelete_Click()
Dim qdf As DAO.QueryDef
Set qdf = CurrentDb.CreateQueryDef("", _
"PARAMETERS Identifier TEXT (255); " & _
"DELETE * FROM Table1 WHERE ID = Identifier")
With qdf
.Parameters("Identifier") = Me.txtID2
.Execute
End With
End Sub
When I use this i received the following: Runtime Error (3464) Datatype Mismatch in criteria expression.
– skooter
Nov 21 '18 at 19:30
Sorry, misread the SQL in your question.ID
is a numeric field so replaceTEXT (255)
withLong
.
– Darren Bartrup-Cook
Nov 22 '18 at 9:15
add a comment |
FROM
must refer to a table (whether a physical table you've built, a stored query, or the result of an embedded SQL string).FROM item = ‘“ & me.txtItem & “‘“
in your code has no meaning to SQL.
This avoids the string concatenation to build up your SQL - just pass the value as a parameter and then execute the query:
Private Sub cmdDelete_Click()
Dim qdf As DAO.QueryDef
Set qdf = CurrentDb.CreateQueryDef("", _
"PARAMETERS Identifier TEXT (255); " & _
"DELETE * FROM Table1 WHERE ID = Identifier")
With qdf
.Parameters("Identifier") = Me.txtID2
.Execute
End With
End Sub
When I use this i received the following: Runtime Error (3464) Datatype Mismatch in criteria expression.
– skooter
Nov 21 '18 at 19:30
Sorry, misread the SQL in your question.ID
is a numeric field so replaceTEXT (255)
withLong
.
– Darren Bartrup-Cook
Nov 22 '18 at 9:15
add a comment |
FROM
must refer to a table (whether a physical table you've built, a stored query, or the result of an embedded SQL string).FROM item = ‘“ & me.txtItem & “‘“
in your code has no meaning to SQL.
This avoids the string concatenation to build up your SQL - just pass the value as a parameter and then execute the query:
Private Sub cmdDelete_Click()
Dim qdf As DAO.QueryDef
Set qdf = CurrentDb.CreateQueryDef("", _
"PARAMETERS Identifier TEXT (255); " & _
"DELETE * FROM Table1 WHERE ID = Identifier")
With qdf
.Parameters("Identifier") = Me.txtID2
.Execute
End With
End Sub
FROM
must refer to a table (whether a physical table you've built, a stored query, or the result of an embedded SQL string).FROM item = ‘“ & me.txtItem & “‘“
in your code has no meaning to SQL.
This avoids the string concatenation to build up your SQL - just pass the value as a parameter and then execute the query:
Private Sub cmdDelete_Click()
Dim qdf As DAO.QueryDef
Set qdf = CurrentDb.CreateQueryDef("", _
"PARAMETERS Identifier TEXT (255); " & _
"DELETE * FROM Table1 WHERE ID = Identifier")
With qdf
.Parameters("Identifier") = Me.txtID2
.Execute
End With
End Sub
answered Nov 21 '18 at 14:20
Darren Bartrup-CookDarren Bartrup-Cook
13.8k11432
13.8k11432
When I use this i received the following: Runtime Error (3464) Datatype Mismatch in criteria expression.
– skooter
Nov 21 '18 at 19:30
Sorry, misread the SQL in your question.ID
is a numeric field so replaceTEXT (255)
withLong
.
– Darren Bartrup-Cook
Nov 22 '18 at 9:15
add a comment |
When I use this i received the following: Runtime Error (3464) Datatype Mismatch in criteria expression.
– skooter
Nov 21 '18 at 19:30
Sorry, misread the SQL in your question.ID
is a numeric field so replaceTEXT (255)
withLong
.
– Darren Bartrup-Cook
Nov 22 '18 at 9:15
When I use this i received the following: Runtime Error (3464) Datatype Mismatch in criteria expression.
– skooter
Nov 21 '18 at 19:30
When I use this i received the following: Runtime Error (3464) Datatype Mismatch in criteria expression.
– skooter
Nov 21 '18 at 19:30
Sorry, misread the SQL in your question.
ID
is a numeric field so replace TEXT (255)
with Long
.– Darren Bartrup-Cook
Nov 22 '18 at 9:15
Sorry, misread the SQL in your question.
ID
is a numeric field so replace TEXT (255)
with Long
.– Darren Bartrup-Cook
Nov 22 '18 at 9:15
add a comment |
You can simply use DELETE in SQL like this.
DELETE FROM Item WHERE ID='" + txtID2.Text + "'
Where you can delete an item base on the items ID.
You can assign the value of you ID to a parameter like this.SqlCmd.Parameters.AddWithValue("@ID", txtID2.Text)
then the query will call the value of the ID.
– Unknown
Nov 21 '18 at 9:06
When I change the sql statement as both of you suggested, it still doesn’t function.
– skooter
Nov 21 '18 at 9:20
@skooter "doesn't function" does not say much. Do you get any errors? Please specify.
– Hans Kesting
Nov 21 '18 at 9:36
@Unknown Be careful with AddWithValue
– Hans Kesting
Nov 21 '18 at 9:37
Immediately it says "Expected: = " so I put SQL = CMD.....
– skooter
Nov 21 '18 at 9:39
|
show 3 more comments
You can simply use DELETE in SQL like this.
DELETE FROM Item WHERE ID='" + txtID2.Text + "'
Where you can delete an item base on the items ID.
You can assign the value of you ID to a parameter like this.SqlCmd.Parameters.AddWithValue("@ID", txtID2.Text)
then the query will call the value of the ID.
– Unknown
Nov 21 '18 at 9:06
When I change the sql statement as both of you suggested, it still doesn’t function.
– skooter
Nov 21 '18 at 9:20
@skooter "doesn't function" does not say much. Do you get any errors? Please specify.
– Hans Kesting
Nov 21 '18 at 9:36
@Unknown Be careful with AddWithValue
– Hans Kesting
Nov 21 '18 at 9:37
Immediately it says "Expected: = " so I put SQL = CMD.....
– skooter
Nov 21 '18 at 9:39
|
show 3 more comments
You can simply use DELETE in SQL like this.
DELETE FROM Item WHERE ID='" + txtID2.Text + "'
Where you can delete an item base on the items ID.
You can simply use DELETE in SQL like this.
DELETE FROM Item WHERE ID='" + txtID2.Text + "'
Where you can delete an item base on the items ID.
edited Nov 22 '18 at 0:01
answered Nov 21 '18 at 9:03
UnknownUnknown
639
639
You can assign the value of you ID to a parameter like this.SqlCmd.Parameters.AddWithValue("@ID", txtID2.Text)
then the query will call the value of the ID.
– Unknown
Nov 21 '18 at 9:06
When I change the sql statement as both of you suggested, it still doesn’t function.
– skooter
Nov 21 '18 at 9:20
@skooter "doesn't function" does not say much. Do you get any errors? Please specify.
– Hans Kesting
Nov 21 '18 at 9:36
@Unknown Be careful with AddWithValue
– Hans Kesting
Nov 21 '18 at 9:37
Immediately it says "Expected: = " so I put SQL = CMD.....
– skooter
Nov 21 '18 at 9:39
|
show 3 more comments
You can assign the value of you ID to a parameter like this.SqlCmd.Parameters.AddWithValue("@ID", txtID2.Text)
then the query will call the value of the ID.
– Unknown
Nov 21 '18 at 9:06
When I change the sql statement as both of you suggested, it still doesn’t function.
– skooter
Nov 21 '18 at 9:20
@skooter "doesn't function" does not say much. Do you get any errors? Please specify.
– Hans Kesting
Nov 21 '18 at 9:36
@Unknown Be careful with AddWithValue
– Hans Kesting
Nov 21 '18 at 9:37
Immediately it says "Expected: = " so I put SQL = CMD.....
– skooter
Nov 21 '18 at 9:39
You can assign the value of you ID to a parameter like this.
SqlCmd.Parameters.AddWithValue("@ID", txtID2.Text)
then the query will call the value of the ID.– Unknown
Nov 21 '18 at 9:06
You can assign the value of you ID to a parameter like this.
SqlCmd.Parameters.AddWithValue("@ID", txtID2.Text)
then the query will call the value of the ID.– Unknown
Nov 21 '18 at 9:06
When I change the sql statement as both of you suggested, it still doesn’t function.
– skooter
Nov 21 '18 at 9:20
When I change the sql statement as both of you suggested, it still doesn’t function.
– skooter
Nov 21 '18 at 9:20
@skooter "doesn't function" does not say much. Do you get any errors? Please specify.
– Hans Kesting
Nov 21 '18 at 9:36
@skooter "doesn't function" does not say much. Do you get any errors? Please specify.
– Hans Kesting
Nov 21 '18 at 9:36
@Unknown Be careful with AddWithValue
– Hans Kesting
Nov 21 '18 at 9:37
@Unknown Be careful with AddWithValue
– Hans Kesting
Nov 21 '18 at 9:37
Immediately it says "Expected: = " so I put SQL = CMD.....
– skooter
Nov 21 '18 at 9:39
Immediately it says "Expected: = " so I put SQL = CMD.....
– skooter
Nov 21 '18 at 9:39
|
show 3 more comments
I have Read your Question the Error in the Your SQL QUERY Try This:
SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText ="DELETE FROM Item WHERE ID='"+txtyoutextbox.Text.Trim()+"';
cmd.ExecuteNonQuery();
With this the code doesn’t do anything
– skooter
Nov 21 '18 at 9:23
How should it read:
– skooter
Nov 21 '18 at 9:35
I'm trying to create a userform with ability to delete from unbound textbox with ID textbox associated. What is best way?
– skooter
Nov 21 '18 at 9:36
you can get textboxbox value and store into int variable int id=Convert.ToInt32(txtyourtextboxname.text); THen Fire the Query Like DELETE FROM Item WHERE ID='"+id+" OR DELETE FROM Item WHERE ID='"+Convert.ToInt32(txtyourtextboxname.text.Trim())+";
– Dipak Rathod
Nov 21 '18 at 10:37
You can use Sqlcommand For That And Command Type=Text
– Dipak Rathod
Nov 21 '18 at 10:41
|
show 5 more comments
I have Read your Question the Error in the Your SQL QUERY Try This:
SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText ="DELETE FROM Item WHERE ID='"+txtyoutextbox.Text.Trim()+"';
cmd.ExecuteNonQuery();
With this the code doesn’t do anything
– skooter
Nov 21 '18 at 9:23
How should it read:
– skooter
Nov 21 '18 at 9:35
I'm trying to create a userform with ability to delete from unbound textbox with ID textbox associated. What is best way?
– skooter
Nov 21 '18 at 9:36
you can get textboxbox value and store into int variable int id=Convert.ToInt32(txtyourtextboxname.text); THen Fire the Query Like DELETE FROM Item WHERE ID='"+id+" OR DELETE FROM Item WHERE ID='"+Convert.ToInt32(txtyourtextboxname.text.Trim())+";
– Dipak Rathod
Nov 21 '18 at 10:37
You can use Sqlcommand For That And Command Type=Text
– Dipak Rathod
Nov 21 '18 at 10:41
|
show 5 more comments
I have Read your Question the Error in the Your SQL QUERY Try This:
SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText ="DELETE FROM Item WHERE ID='"+txtyoutextbox.Text.Trim()+"';
cmd.ExecuteNonQuery();
I have Read your Question the Error in the Your SQL QUERY Try This:
SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText ="DELETE FROM Item WHERE ID='"+txtyoutextbox.Text.Trim()+"';
cmd.ExecuteNonQuery();
edited Nov 21 '18 at 10:58
answered Nov 21 '18 at 9:16
Dipak RathodDipak Rathod
10911
10911
With this the code doesn’t do anything
– skooter
Nov 21 '18 at 9:23
How should it read:
– skooter
Nov 21 '18 at 9:35
I'm trying to create a userform with ability to delete from unbound textbox with ID textbox associated. What is best way?
– skooter
Nov 21 '18 at 9:36
you can get textboxbox value and store into int variable int id=Convert.ToInt32(txtyourtextboxname.text); THen Fire the Query Like DELETE FROM Item WHERE ID='"+id+" OR DELETE FROM Item WHERE ID='"+Convert.ToInt32(txtyourtextboxname.text.Trim())+";
– Dipak Rathod
Nov 21 '18 at 10:37
You can use Sqlcommand For That And Command Type=Text
– Dipak Rathod
Nov 21 '18 at 10:41
|
show 5 more comments
With this the code doesn’t do anything
– skooter
Nov 21 '18 at 9:23
How should it read:
– skooter
Nov 21 '18 at 9:35
I'm trying to create a userform with ability to delete from unbound textbox with ID textbox associated. What is best way?
– skooter
Nov 21 '18 at 9:36
you can get textboxbox value and store into int variable int id=Convert.ToInt32(txtyourtextboxname.text); THen Fire the Query Like DELETE FROM Item WHERE ID='"+id+" OR DELETE FROM Item WHERE ID='"+Convert.ToInt32(txtyourtextboxname.text.Trim())+";
– Dipak Rathod
Nov 21 '18 at 10:37
You can use Sqlcommand For That And Command Type=Text
– Dipak Rathod
Nov 21 '18 at 10:41
With this the code doesn’t do anything
– skooter
Nov 21 '18 at 9:23
With this the code doesn’t do anything
– skooter
Nov 21 '18 at 9:23
How should it read:
– skooter
Nov 21 '18 at 9:35
How should it read:
– skooter
Nov 21 '18 at 9:35
I'm trying to create a userform with ability to delete from unbound textbox with ID textbox associated. What is best way?
– skooter
Nov 21 '18 at 9:36
I'm trying to create a userform with ability to delete from unbound textbox with ID textbox associated. What is best way?
– skooter
Nov 21 '18 at 9:36
you can get textboxbox value and store into int variable int id=Convert.ToInt32(txtyourtextboxname.text); THen Fire the Query Like DELETE FROM Item WHERE ID='"+id+" OR DELETE FROM Item WHERE ID='"+Convert.ToInt32(txtyourtextboxname.text.Trim())+";
– Dipak Rathod
Nov 21 '18 at 10:37
you can get textboxbox value and store into int variable int id=Convert.ToInt32(txtyourtextboxname.text); THen Fire the Query Like DELETE FROM Item WHERE ID='"+id+" OR DELETE FROM Item WHERE ID='"+Convert.ToInt32(txtyourtextboxname.text.Trim())+";
– Dipak Rathod
Nov 21 '18 at 10:37
You can use Sqlcommand For That And Command Type=Text
– Dipak Rathod
Nov 21 '18 at 10:41
You can use Sqlcommand For That And Command Type=Text
– Dipak Rathod
Nov 21 '18 at 10:41
|
show 5 more comments
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53408014%2fdelete-sql-statement-not-functioning%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
3
Please don't build up SQL queries via string concatenation. That leads to SQL Injection.
– Damien_The_Unbeliever
Nov 21 '18 at 9:15
What is the name of the table you are trying to delete from? How would you identify the row(s) to delete (column name and type, value)?
– Hans Kesting
Nov 21 '18 at 9:40
The table is "Item" and the .field is Item the field consists of auto parts
– skooter
Nov 21 '18 at 9:40
After double click "listbox" info is placed in textbox "txtItem" and Id is placed in txtID2
– skooter
Nov 21 '18 at 9:41
sorry yes ms-access
– skooter
Nov 21 '18 at 9:43