请检查此查询是否正确 [英] Please check this query are correct or not
本文介绍了请检查此查询是否正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
string s = 使用CustSelling内部联接从CustSelling,CustSellingItems中删除CustSellingItems内部联接sellpayment,其中CustSelling.SerialNO = CustSellingItems.SerialNO和CustSellingItems.SerialNO = sellpayment.SerialNO =' + dataGridView1.SelectedRows [ 0 ]。单元格[ 0 ]。Value.ToString()+ ';
此错误在FROM子句中出现语法错误。
解决方案
删除 [ ^ ]仅允许您指定一个表格。
您不能同时指定两个表,并且需要使用两个DELETE语句,每个tabl一个e。
DELETE FROM CustSellingItems
WHERE CustSellingItems.SerialNO =< criteria>和
DELETE FROM CustSelling
WHERE CustSelling.SerialNO =< criteria>
Andree Kraak的Solution1非常好。
我建议你阅读:
使用外键的DELETE CASCADE选项 [ ^ ]
级联参考整合约束 [ ^ ]
如何:从数据库中删除行 [ ^ ]
string s = "Delete from CustSelling,CustSellingItems using CustSelling inner join CustSellingItems inner join sellpayment where CustSelling.SerialNO=CustSellingItems.SerialNO and CustSellingItems.SerialNO=sellpayment.SerialNO ='" + dataGridView1.SelectedRows[0].Cells[0].Value.ToString() + "'";
this Error given "syntax error in FROM clause."
解决方案
DELETE FROM[^] only allows you to specify one table.
You cannot specify two table at once and will need to use two DELETE statements, one for each table.
DELETE FROM CustSellingItems WHERE CustSellingItems.SerialNO = <criteria>and
DELETE FROM CustSelling WHERE CustSelling.SerialNO = <criteria>
Solution1 by Andree Kraak is very good.
I would suggest you to read about:
Using DELETE CASCADE Option for Foreign Keys[^]
Cascading Referential Integrity Constraints[^]
How to: Delete Rows From the Database[^]
这篇关于请检查此查询是否正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文