A
Alan Silver
hello,
I am writing my first real ASP.NET application, but am getting a bit
confused with ADO.NEt and the best way to use it.
My old method (with Classic ASP) was to have a function that you called
like ...
Set rsSomething = GrabRS("select * from mytable")
The function would open a connection to the database, pull out the data
and return a disconnected recordset. This could then be used in the ASP.
I want to do something similar in ADO.NET and ASP.NET, but am unsure of
the best way to do it. I have got as far as ...
SqlDataReader GrabDS(String strSQL) {
SqlConnection conConn = New
SqlConnection(ConfigurationSettings.AppSettings["ConnStr"]);
conConn.Open();
SqlCommand comComm = new SqlCommand(strSQL, conConn);
SqlDataReader drdData = comComm.ExecuteReader();
return drdData;
}
but keep getting an error on the first line of the block telling me
there is a missing colon. I have tried all sorts of variations of this,
but can't work out what's wrong.
Any advice? TIA for any help.
I am writing my first real ASP.NET application, but am getting a bit
confused with ADO.NEt and the best way to use it.
My old method (with Classic ASP) was to have a function that you called
like ...
Set rsSomething = GrabRS("select * from mytable")
The function would open a connection to the database, pull out the data
and return a disconnected recordset. This could then be used in the ASP.
I want to do something similar in ADO.NET and ASP.NET, but am unsure of
the best way to do it. I have got as far as ...
SqlDataReader GrabDS(String strSQL) {
SqlConnection conConn = New
SqlConnection(ConfigurationSettings.AppSettings["ConnStr"]);
conConn.Open();
SqlCommand comComm = new SqlCommand(strSQL, conConn);
SqlDataReader drdData = comComm.ExecuteReader();
return drdData;
}
but keep getting an error on the first line of the block telling me
there is a missing colon. I have tried all sorts of variations of this,
but can't work out what's wrong.
Any advice? TIA for any help.