Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

updating only one entry out of multiple..

Status
Not open for further replies.

sspeedy00

Programmer
Dec 3, 2007
12
US
Hiya,

Here's the problem. I have a stored procedure which will contains output variable. It will be called from my .cs file, something like this:

String sqlString = "Exec getEmployeeInfo ';"

but now the stored proc. is expecting output variables, so I declared some and called it like this:
Code:
String sqlString = "Exec getEmployeeInfo '" + @ssn + "'" + " " + "'" + @sdt + "'" + " " + "'" + @sn + "'" + " " + "'" + @wl + "'" + " " + "'" + @ln + "'" + " " + "'" + @fn + "'";

messy, yes. Don't worry about the variable names. It compiles fine, but then here's the runtime error:
Code:
Exception Details: System.Exception: Error: 170: Line 1: Incorrect syntax near '0'.

Source Error: 


Line 628:
Line 629:        Catch e As SqlException
Line 630:            Throw New Exception("Error: " & e.Number & ": " & e.Message)
Line 631:        Finally
Line 632:            ' Close the SQL connection (DataSet is disconnected)

Also, if something is of type datetime in sql server, is that a regular string in C#/asp.net?

TIA.

 
As I pointed out here: thread183-1433101


You need to separate parameters with a comma.

Code:
String sqlString = "Exec getEmployeeInfo '" + @ssn + "'[!],[/!] '" + @sdt + "'[!],[/!] '" + @sn + "'[!],[/!] '" + @wl + "'[!],[/!] '" + @ln + "'[!],[/!] '" + @fn + "'";

-George

"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top