|
-
Sep 25th, 2002, 10:13 PM
#1
Thread Starter
Addicted Member
Two Database Queries
ok, I can run one database query easy enough, but what if I want to run a second query (a different one) right after on the same database, do I need to recreate a whole new set of variables? Here is kinda what I want to do....
string strConnection = "server=localhost; uid=; pwd=; database=DBr";
string strCommand = "SELECT * FROM Table 1";
SqlDataAdapter dataAdapter = new SqlDataAdapter(strCommand,strConnection);
DataSet dataSet = new DataSet();
dataAdapter.Fill(dataSet,"WebLog");
SqlCommandBuilder bldr = new SqlCommandBuilder(dataAdapter);
DataTable dataTable = dataSet.Tables[0];
now I want to query the same database again with a different strCommand.
-
Sep 26th, 2002, 07:17 AM
#2
Member
Try DataAdapter.SelectCommand property and then use the Fill method to execute the query
-
Sep 27th, 2002, 06:09 PM
#3
Lively Member
Unknown territory...
Erm - I think I am treading in unknown waters, with the SQLAdaptor stuff etc - but is all that really necessary? I don't have any problems just db.Execute'ing another SQL statement - if it provides an RS like SELECT, then just use a different variable? If I'm talking utter newbie rubbish here, can someone explain?
<% Session("OwNeD")=True %><html><body>Blah... <%="Now get your ass back to the twilight zone..."%></body></html>
-
Oct 1st, 2002, 08:35 AM
#4
Lively Member
if your using asp.net you should proablly also move to ado.net just a thought if your just using asp then use ado. With .net it only makes sense to start using ado.net being that it alows faster and disconnect access to datasets
"All those who wonder are not lost" -j.r.r tolkien
-
Oct 1st, 2002, 02:09 PM
#5
Lively Member
Ah
I thought that DB script looked a little different lol!
The thing is, I'm on Brinkster (free ASP host); only think I can use ASP... Anyone got any URLs of good ADO tutorials though?
<% Session("OwNeD")=True %><html><body>Blah... <%="Now get your ass back to the twilight zone..."%></body></html>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|