Hello All!
I'm coding my UPDATE button on my data grid. Getting a syntax error, can't
seen to find it. Hope you can help
Thanks!!!
Rudy
Public Sub grdProducts_Upd ateCommand(ByVa l source As Object, ByVal e As
System.Web.UI.W ebControls.Data GridCommandEven tArgs) Handles
grdProducts.Upd ateCommand
Dim Sqlconnection1 As New SqlConnection(S QL_CONNECTION_S TRING)
Dim cmdProd As SqlCommand
Dim txtProductName As String = e.Item.Cells(1) .Text
Dim txtSupplier As String = e.Item.Cells(2) .Text
Dim txtCost As String = e.Item.Cells(4) .Text
Dim txtSRP As String = e.Item.Cells(5) .Text
Dim txtInStock As String = e.Item.Cells(3) .Text
Dim strUpdate As String
strUpdate = "UPDATE IMSProducts SET " & _
"ProductNam e = ' " & txtProductName & " ', " & _
"Supplier = ' " & txtSupplier & " ', " & _
"Cost = ' " & txtCost & " ', " & _
"SRP = ' " & txtSRP & " ', " & _
"InStock = ' " & txtInStock & " ', " & _
"WHERE ProductID = ' " & e.Item.Cells(0) .Text & " '"
Sqlconnection1 = New
SqlConnection(C onfigurationSet tings.AppSettin gs("ConnString" ))
cmdProd = New SqlCommand(strU pdate, Sqlconnection1)
SqlConnection1. Open()
cmdProd.Execute NonQuery()
grdProducts.Edi tItemIndex = -1
BindProductsGri d()
End Sub 3 1095
Sorry, I forgot to tell you where the error is, it's on this line
"WHERE ProductID = ' " & e.Item.Cells(0) .Text & " '"
Thanks Again!!
"Rudy" wrote: Hello All!
I'm coding my UPDATE button on my data grid. Getting a syntax error, can't seen to find it. Hope you can help Thanks!!!
Rudy
Public Sub grdProducts_Upd ateCommand(ByVa l source As Object, ByVal e As System.Web.UI.W ebControls.Data GridCommandEven tArgs) Handles grdProducts.Upd ateCommand
Dim Sqlconnection1 As New SqlConnection(S QL_CONNECTION_S TRING) Dim cmdProd As SqlCommand Dim txtProductName As String = e.Item.Cells(1) .Text Dim txtSupplier As String = e.Item.Cells(2) .Text Dim txtCost As String = e.Item.Cells(4) .Text Dim txtSRP As String = e.Item.Cells(5) .Text Dim txtInStock As String = e.Item.Cells(3) .Text Dim strUpdate As String
strUpdate = "UPDATE IMSProducts SET " & _ "ProductNam e = ' " & txtProductName & " ', " & _ "Supplier = ' " & txtSupplier & " ', " & _ "Cost = ' " & txtCost & " ', " & _ "SRP = ' " & txtSRP & " ', " & _ "InStock = ' " & txtInStock & " ', " & _ "WHERE ProductID = ' " & e.Item.Cells(0) .Text & " '" Sqlconnection1 = New SqlConnection(C onfigurationSet tings.AppSettin gs("ConnString" )) cmdProd = New SqlCommand(strU pdate, Sqlconnection1) SqlConnection1. Open() cmdProd.Execute NonQuery()
grdProducts.Edi tItemIndex = -1 BindProductsGri d()
End Sub
Rudy,
You may be getting error bcoz u r using ProductID = ' " instead of ""
(double quotation marks)...
"Rudy" wrote: Sorry, I forgot to tell you where the error is, it's on this line "WHERE ProductID = ' " & e.Item.Cells(0) .Text & " '" Thanks Again!!
"Rudy" wrote:
Hello All!
I'm coding my UPDATE button on my data grid. Getting a syntax error, can't seen to find it. Hope you can help Thanks!!!
Rudy
Public Sub grdProducts_Upd ateCommand(ByVa l source As Object, ByVal e As System.Web.UI.W ebControls.Data GridCommandEven tArgs) Handles grdProducts.Upd ateCommand
Dim Sqlconnection1 As New SqlConnection(S QL_CONNECTION_S TRING) Dim cmdProd As SqlCommand Dim txtProductName As String = e.Item.Cells(1) .Text Dim txtSupplier As String = e.Item.Cells(2) .Text Dim txtCost As String = e.Item.Cells(4) .Text Dim txtSRP As String = e.Item.Cells(5) .Text Dim txtInStock As String = e.Item.Cells(3) .Text Dim strUpdate As String
strUpdate = "UPDATE IMSProducts SET " & _ "ProductNam e = ' " & txtProductName & " ', " & _ "Supplier = ' " & txtSupplier & " ', " & _ "Cost = ' " & txtCost & " ', " & _ "SRP = ' " & txtSRP & " ', " & _ "InStock = ' " & txtInStock & " ', " & _ "WHERE ProductID = ' " & e.Item.Cells(0) .Text & " '" Sqlconnection1 = New SqlConnection(C onfigurationSet tings.AppSettin gs("ConnString" )) cmdProd = New SqlCommand(strU pdate, Sqlconnection1) SqlConnection1. Open() cmdProd.Execute NonQuery()
grdProducts.Edi tItemIndex = -1 BindProductsGri d()
End Sub
You have a comma before the WHERE statement.
"InStock = ' " & txtInStock & " ', " & _
"WHERE ProductID = ' " & e.Item.Cells(0) .Text & " '"
Shawn
"Rudy" <Ru**@discussio ns.microsoft.co m> wrote in message
news:FE******** *************** ***********@mic rosoft.com... Sorry, I forgot to tell you where the error is, it's on this line "WHERE ProductID = ' " & e.Item.Cells(0) .Text & " '" Thanks Again!!
"Rudy" wrote:
Hello All!
I'm coding my UPDATE button on my data grid. Getting a syntax error,
can't seen to find it. Hope you can help Thanks!!!
Rudy
Public Sub grdProducts_Upd ateCommand(ByVa l source As Object, ByVal e As System.Web.UI.W ebControls.Data GridCommandEven tArgs) Handles grdProducts.Upd ateCommand
Dim Sqlconnection1 As New SqlConnection(S QL_CONNECTION_S TRING) Dim cmdProd As SqlCommand Dim txtProductName As String = e.Item.Cells(1) .Text Dim txtSupplier As String = e.Item.Cells(2) .Text Dim txtCost As String = e.Item.Cells(4) .Text Dim txtSRP As String = e.Item.Cells(5) .Text Dim txtInStock As String = e.Item.Cells(3) .Text Dim strUpdate As String
strUpdate = "UPDATE IMSProducts SET " & _ "ProductNam e = ' " & txtProductName & " ', " & _ "Supplier = ' " & txtSupplier & " ', " & _ "Cost = ' " & txtCost & " ', " & _ "SRP = ' " & txtSRP & " ', " & _ "InStock = ' " & txtInStock & " ', " & _ "WHERE ProductID = ' " & e.Item.Cells(0) .Text & " '" Sqlconnection1 = New SqlConnection(C onfigurationSet tings.AppSettin gs("ConnString" )) cmdProd = New SqlCommand(strU pdate, Sqlconnection1) SqlConnection1. Open() cmdProd.Execute NonQuery()
grdProducts.Edi tItemIndex = -1 BindProductsGri d()
End Sub This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: nu b |
last post by:
Hello all. I am new and I am having a tough time spotting my error here. The
idea is to produce an applet that will have a JButton which I can push to
display the string myName. Later I will make it so that it will chage the
font size and style, but for now I can't even get it to display the String.
It compiles fine but when I launch it in the browser or with the
appletviewer, it shows the button and nothing happens when I click it. Can...
|
by: deko |
last post by:
I use this convention frequently:
Exit_Here:
Exit Sub
HandleErr:
Select Case Err.Number
Case 3163
Resume Next
Case 3376
Resume Next
|
by: p |
last post by:
WE had a Crystal 8 WebApp using vs 2002 which we upgraded to VS2003. I also
have Crystal 9 pro on my development machine. The web app runs fine on my
dev machine but am having problems deploying. I created the websetup and
built the MSI, have the bundled version. Copied to webserver and ran
Websetup.msi. Said I had to remove old version, which I did, then reran
WebSetup.msi and keeps giving me this error. "The installer was interrupted...
|
by: nkosinathi |
last post by:
Hi Guys
im trying to write an import class where i can import information from .CSV file into my database. I am getting the following error
Errors: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 PHP Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |