Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I want to use table1 in page1 and table2 in page2 of a database in one website .

when I add table2 to page2 my page1 connection lost .

 

please help me .

  • Administrators
Posted

Any chance you could post a bit of your code to give us some idea of how you are attempting this?

Are you creating and opening a connection on every page? Are you refreshing the dataset on page_loads or storing it in a session variable between page refreshes?

 

the following may be worth a look as well

http://www.xtremedotnettalk.com/showthread.php?t=75209

http://www.xtremedotnettalk.com/showthread.php?t=75076

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted

I dont know the right way for doing this ,

but what I tried is code something like this :

 

in page1

 

 

this.dbCon = new System.Data.OleDb.OleDbConnection() ;

this.adb1 = new System.Data.OleDb.OleDbDataAdapter();

this.ds1 = new ShipProject.dataset1();

this.dbCon.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +

Server.MapPath("~/database/data.mdb") ;

 

in page2 I cant access to dbCon so I create another one like page1's connection .

but the problem apeared :

my first dbConnection lost .

What I must to do for it ,

Thanks

  • 3 weeks later...
Posted

ADO .NET uses a disconnected dataset model - you should load both your tables into

one dataset using one connection - the connection is then released - now use your tables.

IN PARVUM MULTUM

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...