Saturday, May 22, 2010

How to call SQL server stored procedure in c#.net function?

you should use an sql connection object from the component toolbar n make a connected architecture.. and then drag n drop an sql command object . in that object's property set type = stored procedure and then proceed. it's as simple as that in visual studio..


in query builder u'll get the type as : create procedure %26lt;%26gt; as.... GO.


then in ur code for d form write:


SqlCommand cmd = new SqlCommand (%26lt;proc.name%26gt;, %26lt;connection name%26gt;);


cmd.CommandType=CommandType.StoredProc...


cmd.Parameters.Add( new SqlParameter("@%26lt;pname%26gt;",%26lt;type%26gt;,value,%26lt;co... name%26gt;));


cmd.ExecuteNonQuery();


hope thiswill work for u?

phlox

No comments:

Post a Comment