这是我之前为此查询提供的例外 [英] It is the exception I got earlier for this query

查看:75
本文介绍了这是我之前为此查询提供的例外的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

file:/// C:/Users/naveen.kumar/Desktop/oledbexception.PNG



更新声明中的语法错误。



file:/// C:/Users/naveen.kumar/Desktop/syntax%20error%20for%20delete%20stst.PNG



FROM子句中的语法错误



我尝试过:



更新oledb stmt

cmd =新OleDbCommand(InvoiceItems更新,产品组描述='+ txtProductName +',Quantity ='+ txtQty.Text +',UOM =' + txtUOM.Text +',UnitPrice ='+ txtUnitPrice.Text +',GrossAmount ='+ txtGrossAmount.Text +',VAT ='+ txtVAT.Text +',VatAmount ='+来自InvoiceItems的TxtVatAmount.Text +',Total ='+ txtTotal.Text +',InvoiceNumber = Products.CroductId order by InvoiceNumber ='+ products + conn );



删除oledb stmt

cmd = new OleDbCommand(DELETE FROM InvoiceNumber,INVOICEN O来自InvoiceItems WHERE InvoiceItems.InvoiceNumber = TAXINVOICE.INVOICENO和InvoiceNumber =+ txtInvoice.ToString()+,conn);

file:///C:/Users/naveen.kumar/Desktop/oledbexception.PNG

Syntax error in Update statement.

file:///C:/Users/naveen.kumar/Desktop/syntax%20error%20for%20delete%20stst.PNG

Syntax error in FROM Clause

What I have tried:

Update oledb stmt
cmd = new OleDbCommand("UPDATE from InvoiceItems,Products set Description ='" + txtProductName + "',Quantity = '" + txtQty.Text + "',UOM = '" + txtUOM.Text + "',UnitPrice ='" + txtUnitPrice.Text + "',GrossAmount ='" + txtGrossAmount.Text + "',VAT = '" + txtVAT.Text + "',VatAmount ='" + txtVatAmount.Text + "',Total ='" + txtTotal.Text + "' from InvoiceItems,Products where InvoiceItems.ProductId = Products.ProductId order by InvoiceNumber='" + txtInvoice.Text.Trim() + "'", conn);

Delete oledb stmt
cmd = new OleDbCommand("DELETE FROM InvoiceNumber,INVOICENO from InvoiceItems WHERE InvoiceItems.InvoiceNumber=TAXINVOICE.INVOICENO and InvoiceNumber=" + txtInvoice.ToString() + "", conn);

推荐答案

查询错误。它应该是这样的:



The query is wrong. It should be something like:

UPDATE InvoiceItems SET <<fields>> FROM InvoiceItems, Products where <<where conditions>>





我猜你必须更新InvoiceItems表,记住你一次只能更新一个表。



注意:我认为DELETE命令查询也是错误的。



再见



I guess you have to update the InvoiceItems table, remember you can update only a table at a time.

Note: I think that also the DELETE command query is wrong.

Bye


这篇关于这是我之前为此查询提供的例外的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆