.NET Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgramming.NET Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old July 20th, 2003, 08:49 AM
Bradstar Bradstar is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 2 Bradstar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Urgent ASP.net Database Help Required...

I am fairly new to ASP.net, so can someone show me how to connect to an Access database, pull a record from a table, and then use that record to identify a second record in a different table?

Hopefully that is understandable...

In short, this is what I said,
1.) Connect to database
2.) Select an ID from Table1
3.) Select a name from Table 2 where TheID = ID from table 1

I hope someone can help me with this... I have been working on this for two days now...

P.S. Can someone do this as an example for me, hopefully connecting in ADOB format? Thanks.

Reply With Quote
  #2  
Old August 5th, 2003, 02:06 PM
LeonJollans LeonJollans is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 27 LeonJollans User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
connect to DB

using System.Data;
using System.Data.Oledb

...

OleDbConnection conn = new OleDbConnection(myConnectionString);

OleDbCommand comm = new OleDbCommand();
comm.CommandText = String.Format("Select t2.* from table1 t1 inner join table2 t2 on t2.TheID = t1.ID where t2.id={0}", SomeID );
comm.Connection = conn;
try{
conn.Open();
OledbDataReader reader = comm.ExecuteReader();
}
catch( OledbException ex ){
// handle the error
}
finally{
conn.Close();
}

...

public string SomeID{
get{
return 1.ToString(); // or whatever
}
}

Reply With Quote
Reply

Viewing: ASP Free ForumsProgramming.NET Development > Urgent ASP.net Database Help Required...


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT