473,799 Members | 2,934 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Issue with Update String....

Hello there,

this is the piece of code that if giving problems right now;

cnSQL = New SqlConnection(C onnectionString )

**** strSQL = "UPDATE tb_product SET (ProductID = @cProductID, Code = @Code,
ServiceName = @ServiceName, Price = @Price " & _

"WHERE ProductID = @cProductID)" ****

cmSQL = New SqlCommand(strS QL, cnSQL)

cmSQL.Parameter s.Add("@cProduc tID", SqlDbType.Int). Value = txtProductID.Te xt

cmSQL.Parameter s.Add("@Code", SqlDbType.Char) .Value = txtServiceCode. Text

cmSQL.Parameter s.Add("@Service Name", SqlDbType.Char) .Value =
txtServiceName. Text

cmSQL.Parameter s.Add("@Price", SqlDbType.Money ).Value = txtPrice.Text

Can anybody tell me please why am I getting an general error saying that the
input String is not in the correct format?

Thanks very much,

Manny


Nov 20 '05 #1
6 1276
"WHERE ProductID = @cProductID)"

you forgot to open your where

"WHERE (ProductID = @cProductID)"

"Manuel Canas" <mc*****@hotmai l.com> wrote in message
news:wEmDc.7581 $l6.5278@clgrps 12...
Hello there,

this is the piece of code that if giving problems right now;

cnSQL = New SqlConnection(C onnectionString )

**** strSQL = "UPDATE tb_product SET (ProductID = @cProductID, Code =
@Code,
ServiceName = @ServiceName, Price = @Price " & _

"WHERE ProductID = @cProductID)" ****

cmSQL = New SqlCommand(strS QL, cnSQL)

cmSQL.Parameter s.Add("@cProduc tID", SqlDbType.Int). Value =
txtProductID.Te xt

cmSQL.Parameter s.Add("@Code", SqlDbType.Char) .Value = txtServiceCode. Text

cmSQL.Parameter s.Add("@Service Name", SqlDbType.Char) .Value =
txtServiceName. Text

cmSQL.Parameter s.Add("@Price", SqlDbType.Money ).Value = txtPrice.Text

Can anybody tell me please why am I getting an general error saying that
the
input String is not in the correct format?

Thanks very much,

Manny


Nov 20 '05 #2
Never mind, I thought I was on to something for a min. Sorry.

"Manuel Canas" <mc*****@hotmai l.com> wrote in message
news:wEmDc.7581 $l6.5278@clgrps 12...
Hello there,

this is the piece of code that if giving problems right now;

cnSQL = New SqlConnection(C onnectionString )

**** strSQL = "UPDATE tb_product SET (ProductID = @cProductID, Code =
@Code,
ServiceName = @ServiceName, Price = @Price " & _

"WHERE ProductID = @cProductID)" ****

cmSQL = New SqlCommand(strS QL, cnSQL)

cmSQL.Parameter s.Add("@cProduc tID", SqlDbType.Int). Value =
txtProductID.Te xt

cmSQL.Parameter s.Add("@Code", SqlDbType.Char) .Value = txtServiceCode. Text

cmSQL.Parameter s.Add("@Service Name", SqlDbType.Char) .Value =
txtServiceName. Text

cmSQL.Parameter s.Add("@Price", SqlDbType.Money ).Value = txtPrice.Text

Can anybody tell me please why am I getting an general error saying that
the
input String is not in the correct format?

Thanks very much,

Manny


Nov 20 '05 #3
Hi,

Try this.

strSQL = "UPDATE tb_product SET ProductID = @cProductID, Code = @Code,
ServiceName = @ServiceName, Price = @Price " & _
"WHERE ProductID = @cProductID"

Ken
-------------------

"Manuel Canas" <mc*****@hotmai l.com> wrote in message
news:wEmDc.7581 $l6.5278@clgrps 12:
Hello there,

this is the piece of code that if giving problems right now;

cnSQL = New SqlConnection(C onnectionString )

**** strSQL = "UPDATE tb_product SET (ProductID = @cProductID, Code =
@Code,
ServiceName = @ServiceName, Price = @Price " & _

"WHERE ProductID = @cProductID)" ****

cmSQL = New SqlCommand(strS QL, cnSQL)

cmSQL.Parameter s.Add("@cProduc tID", SqlDbType.Int). Value =
txtProductID.Te xt

cmSQL.Parameter s.Add("@Code", SqlDbType.Char) .Value =
txtServiceCode. Text

cmSQL.Parameter s.Add("@Service Name", SqlDbType.Char) .Value =
txtServiceName. Text

cmSQL.Parameter s.Add("@Price", SqlDbType.Money ).Value = txtPrice.Text

Can anybody tell me please why am I getting an general error saying that
the
input String is not in the correct format?

Thanks very much,

Manny


--
Outgoing mail is certified Virus Free.
Checked by AVG Anti-Virus (http://www.grisoft.com).
Version: 7.0.230 / Virus Database: 263.3.6 - Release Date: 6/25/2004
Nov 20 '05 #4
Hi Ken, No luck with what you suggested.

Do you have anymore suggestions on this one?

Thanks for your help.

Manny.

"Ken Tucker [MVP]" <vb***@bellsout h.net> wrote in message
news:uu******** *****@TK2MSFTNG P10.phx.gbl...
Hi,

Try this.

strSQL = "UPDATE tb_product SET ProductID = @cProductID, Code = @Code,
ServiceName = @ServiceName, Price = @Price " & _
"WHERE ProductID = @cProductID"

Ken
-------------------

"Manuel Canas" <mc*****@hotmai l.com> wrote in message
news:wEmDc.7581 $l6.5278@clgrps 12:
Hello there,

this is the piece of code that if giving problems right now;

cnSQL = New SqlConnection(C onnectionString )

**** strSQL = "UPDATE tb_product SET (ProductID = @cProductID, Code =
@Code,
ServiceName = @ServiceName, Price = @Price " & _

"WHERE ProductID = @cProductID)" ****

cmSQL = New SqlCommand(strS QL, cnSQL)

cmSQL.Parameter s.Add("@cProduc tID", SqlDbType.Int). Value =
txtProductID.Te xt

cmSQL.Parameter s.Add("@Code", SqlDbType.Char) .Value =
txtServiceCode. Text

cmSQL.Parameter s.Add("@Service Name", SqlDbType.Char) .Value =
txtServiceName. Text

cmSQL.Parameter s.Add("@Price", SqlDbType.Money ).Value = txtPrice.Text

Can anybody tell me please why am I getting an general error saying that
the
input String is not in the correct format?

Thanks very much,

Manny


--
Outgoing mail is certified Virus Free.
Checked by AVG Anti-Virus (http://www.grisoft.com).
Version: 7.0.230 / Virus Database: 263.3.6 - Release Date: 6/25/2004

Nov 20 '05 #5
Hi,

Actually you need a stored procedure to use parameters. Two options
add a stored procedure to the database or manually insert the values in
the sql statement.

Ken
--------------------

"Manuel Canas" <mc*****@hotmai l.com> wrote in message
news:QHnDc.7587 $l6.4925@clgrps 12:
Hi Ken, No luck with what you suggested.

Do you have anymore suggestions on this one?

Thanks for your help.

Manny.

"Ken Tucker [MVP]" <HYPERLINK
"mailto:vb***@b ellsouth.net"vb ***@bellsouth.n et> wrote in message
news:uu******** *****@TK2MSFTNG P10.phx.gbl...
Hi,

Try this.

strSQL = "UPDATE tb_product SET ProductID = @cProductID, Code = @Code,
ServiceName = @ServiceName, Price = @Price " & _
"WHERE ProductID = @cProductID"

Ken
-------------------

"Manuel Canas" <HYPERLINK
"mailto:mc***** @hotmail.com"mc *****@hotmail.c om> wrote in message
news:wEmDc.7581 $l6.5278@clgrps 12:

Hello there,

this is the piece of code that if giving problems right now;

cnSQL = New SqlConnection(C onnectionString )

**** strSQL = "UPDATE tb_product SET (ProductID = @cProductID, Code
=
@Code,
ServiceName = @ServiceName, Price = @Price " & _

"WHERE ProductID = @cProductID)" ****

cmSQL = New SqlCommand(strS QL, cnSQL)

cmSQL.Parameter s.Add("@cProduc tID", SqlDbType.Int). Value =
txtProductID.Te xt

cmSQL.Parameter s.Add("@Code", SqlDbType.Char) .Value =
txtServiceCode. Text

cmSQL.Parameter s.Add("@Service Name", SqlDbType.Char) .Value =
txtServiceName. Text

cmSQL.Parameter s.Add("@Price", SqlDbType.Money ).Value =
txtPrice.Text

Can anybody tell me please why am I getting an general error saying
that
the
input String is not in the correct format?

Thanks very much,

Manny

--
Outgoing mail is certified Virus Free.
Checked by AVG Anti-Virus (http://www.grisoft.com).
Version: 7.0.230 / Virus Database: 263.3.6 - Release Date: 6/25/2004


--
Outgoing mail is certified Virus Free.
Checked by AVG Anti-Virus (http://www.grisoft.com).
Version: 7.0.230 / Virus Database: 263.3.6 - Release Date: 6/25/2004
Nov 20 '05 #6
Set the SQL String to the cmSQL.CommandTe xt following the declarations of
the Parameters. Pararmeters are allowed in direct SQL statements, but they
must be referenced in the SQL statement in the order in which they are
declared - the naming of the parameters would lead you to believe that this
does not need to be so, but it is.

Syntactically, the statement looks OK. My guess would be that one of your
parameters is empty, and therefore is killing the SQL statement. What is
the error? Run a debug and check out the values of each of the parameters
right before the statement is executed.
"Manuel Canas" <mc*****@hotmai l.com> wrote in message
news:wEmDc.7581 $l6.5278@clgrps 12...
Hello there,

this is the piece of code that if giving problems right now;

cnSQL = New SqlConnection(C onnectionString )

**** strSQL = "UPDATE tb_product SET (ProductID = @cProductID, Code = @Code, ServiceName = @ServiceName, Price = @Price " & _

"WHERE ProductID = @cProductID)" ****

cmSQL = New SqlCommand(strS QL, cnSQL)

cmSQL.Parameter s.Add("@cProduc tID", SqlDbType.Int). Value = txtProductID.Te xt
cmSQL.Parameter s.Add("@Code", SqlDbType.Char) .Value = txtServiceCode. Text

cmSQL.Parameter s.Add("@Service Name", SqlDbType.Char) .Value =
txtServiceName. Text

cmSQL.Parameter s.Add("@Price", SqlDbType.Money ).Value = txtPrice.Text

Can anybody tell me please why am I getting an general error saying that the input String is not in the correct format?

Thanks very much,

Manny


Nov 20 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2738
by: Drifter | last post by:
The quote below is part of the information i want to save to a MS Access database - or update, as the case may be. The original database was built a long time ago, and looking at the code for add/update on the original site-it does not compensate for odd syntax like the quotes. Problem i am hitting now is syntax issue in the SQL when I go to save/update. The syntax present causes failures every time. User said she had no problems...
6
5668
by: Kerry Sanders | last post by:
I am working on a project for work where I need a specialized type converter to convert the value of a string which is edited in a grid back to the underlying object type from the cell. The value in the cell is displayed as a string from the ToString() method in the class. Anyway, I am trying to implement my converter, but I am having a little trouble understanding it fully and how exactly to implement some of the methods, especially...
2
5868
by: Steve Pierce | last post by:
I am having some issues with a runtime dropdownlist in a datagrid. The issue is that I cannot get ViewState to fill the selected index of a runtime dropdown properly on postback. I do not want to use template columns as they seem to be a little difficult to create at runtime. Any assistance would be very greatly appreciated. private void DataGrid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e) { if...
2
2703
by: john | last post by:
Hello, We have a tablet pc that is trying to sync data to our main sql server during the night but we keep getting a timeout issue. The tablet pc has an access database that contains about 5000 rows of data. We have setup the machine.config for a executionTimeout of 900. Below is our code for the specific vb.net app and the webservice it uses. Can someone see if I am missing something as to why this is bombing out? Also is there a
9
3065
by: Kelii | last post by:
I've been trying to get this piece to work for a few hours, but have given up. I hope someone out there can help, I think the issue is relatively straightforward, but being a novice, I'm stumped. Below you will find the code I've written and the error that results. I'm hoping that someone can give me some direction as to what syntax or parameter is missing from the code that is expected by VBA. Overview: I'm trying to copy calculated...
0
5523
by: Phillip Ian | last post by:
Tried this over in CSharp.General and didn't get anything, so I thought I'd try again here. If there's an AJAX specific group I could ask this in, please let me know...I did look. I'm trying to code what I think is a fairly typical Master/Detail scenario with two GridViews, using AJAX. Using the Northwind sample, I have two ObjectDataSources - one which pulls data from the Orders table, and one that pulls the related data from . Each...
4
6086
by: tim.cavins | last post by:
I have a GridView populated by an ObjectDataSource. I am having issues passing the parameters to the objectdatasource. I have verified that the method is being called but none of the parameters are being populated. Integers are being passed as 0 and strings are empty regardless of what I changed them to in Edit mode on the GridView. My object method to perform the update:
1
1971
by: klaul | last post by:
Hi there. I'm having an issue with autopostback, in that it doesn't seem to be working! The webform I am using pulls the data from an AccessDataSource to populate the gridview, which has Edit and Delete functions. I have also configured it so that I can insert into the gridview using the footer row. What I am now trying to do is create two searchable dropdowns in the header of the first two columns (company and reference) that would just...
1
2375
by: jonbartlam | last post by:
Hi There I'm not sure what exactly is going wrong here. I'm writing an application that retreives a table from a database (tbl_internalfaults) and updates it. (Actually, just the status column will need updating with 'CLOSED' where necessary.) I have been trying to use the OLEDB command builder to build the statement to update the database however it is returning an error whenever I try to do this. I already have a dataset full of data, 1...
4
3590
by: raghuvendra | last post by:
Hi I have a jsp page with 4 columns: namely Category name , Category order, Input field and a submit button. All these are aligned in a row. And Each Category Name has its corresponding Category order, Input field and a submit button. The Category name is being fetched from the oracle db along with the corresponding Category order. In the corresponding input field (text box) the user enters a new category order which gets stored in the...
0
9546
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,...
1
10247
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,...
0
10031
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9079
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7571
isladogs
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...
0
6809
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();...
1
4146
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3762
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2941
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.