Hi,
I am trying to execute a codeline similar to the following
rs3 = cn2.Execute(strsql);
but i guess in c# i have to pass some arguments ato exceute the strsql. Can someone enlighten me on this topic.
Thankyou
Hi,
I am trying to execute a codeline similar to the following
rs3 = cn2.Execute(strsql);
but i guess in c# i have to pass some arguments ato exceute the strsql. Can someone enlighten me on this topic.
Thankyou
I think you should have a look at the classes & interfaces that ADO.NET provides to you:
IDbConnection, ICommand, SqlConnection, SqlCommand, etc.... Have a look in the System.Data namespace.
For instance:
// setup a connection to a sql server
SqlConnection conn = new SqlConnection( "here is the connectionstring" );
SqlCommand cmd = new SqlCommand(conn);
cmd.CommandText = "SELECT * FROM table WHERE Id = @pId";
cmd.Parameters.Add ("@pId", SqlDbType.Int).Value = 1;
using( SqlDataReader dr = cmd.ExecuteReader() )
{
}