Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Iain Duthie
Starting Member
17 Posts |
Posted - 2005-01-21 : 09:54:17
|
I am getting an error saying, "Syntax error converting the varchar value '1-10448-1' to a column of data type int." In the Sql table the data type is a varchar so I don't know why its trying to convert it to an int.CheersIain |
|
chadmat
The Chadinator
1974 Posts |
Posted - 2005-01-21 : 12:11:00
|
Can you post the code that is generating this error?-Chadhttp://www.clrsoft.comSoftware built for the Common Language Runtime. |
 |
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2005-01-21 : 13:44:56
|
i'd check the datatypes of paramters used for stored procedure if you use them. that can be very easy to mess up...Go with the flow & have fun! Else fight the flow |
 |
|
Iain Duthie
Starting Member
17 Posts |
Posted - 2005-01-24 : 04:27:56
|
sqlCmd1.CommandText = "UPDATE manufact_table SET drawing_no = " + (TXTDnumber.Text) + " WHERE (drawing_no = " + TXTDrawing_no.Text + ")";This is the code that generates the error. I can't see anything wrong with it. The problem seems to be that it doesn't like the number that is the TXTDrawing_no part because the number is 1-10448-1. |
 |
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2005-01-24 : 05:44:36
|
then it needs to be like this:"UPDATE manufact_table SET drawing_no = '" + (TXTDnumber.Text) + "' WHERE (drawing_no = '" + TXTDrawing_no.Text + "')";note the ' around text.Go with the flow & have fun! Else fight the flow |
 |
|
Iain Duthie
Starting Member
17 Posts |
Posted - 2005-01-24 : 06:07:28
|
I have tried putting the ' around text but the still gives the same error. |
 |
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2005-01-24 : 07:23:49
|
drawing_no is varchar, right? it's not int.Go with the flow & have fun! Else fight the flow |
 |
|
Iain Duthie
Starting Member
17 Posts |
Posted - 2005-01-24 : 09:47:04
|
Yes it's a varchar |
 |
|
chadmat
The Chadinator
1974 Posts |
Posted - 2005-01-24 : 13:21:45
|
Post the Table DDL. Also run profiler and capture the exact SQL that is being run (Or you can set a breakpoint in your code, and get the SQL String from the watch window).-Chadhttp://www.clrsoft.comSoftware built for the Common Language Runtime. |
 |
|
Iain Duthie
Starting Member
17 Posts |
Posted - 2005-02-18 : 09:51:20
|
Thank you all for your I have managed to solve the problem I was having.CheersIain. |
 |
|
|
|
|