|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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. |
|
#2
|
|||
|
|||
|
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 } } |
![]() |
| Viewing: ASP Free Forums > Programming > .NET Development > Urgent ASP.net Database Help Required... |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|