Can't get a SQL command to recognise the params added
Posted
by littlechris
on Stack Overflow
See other posts from Stack Overflow
or by littlechris
Published on 2010-04-25T19:50:03Z
Indexed on
2010/04/25
20:43 UTC
Read the original article
Hit count: 278
Hi,
I've not used basic SQL commands for a while and I'm trying to pass a param to a sproc and the run it. However when I run the code I get a "Not Supplied" error.
Code:
SqlConnection conn1 = new SqlConnection(DAL.getConnectionStr());
SqlCommand cmd1 = new SqlCommand("SProc_Item_GetByID", conn1);
cmd1.Parameters.Add(new SqlParameter("@ID", itemId));
conn1.Open();
cmd1.ExecuteNonQuery();
I'm not really sure why this would fail. Apologies for the basic question, but I'm lost!
Thanks in advance.
© Stack Overflow or respective owner