View Single Post
  #2 (permalink)  
Old February 5th, 2011, 03:22 PM
Imar's Avatar
Imar Imar is offline
Wrox Author
Points: 72,038, Level: 100
Points: 72,038, Level: 100 Points: 72,038, Level: 100 Points: 72,038, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,080
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi there,

SQL Server doesn't use the ? for parameters, but @parameterName. So, this should work:

"insert into Computer " +
"(Id, Name) " +
"values " +
"(@id, @name)";

You may need to repeat the @ in the call to Parameters.Add. Can't recall if you have to, or can leave it out there.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote