system err while calling fill method of 2nd data adapter

  • Thread starter Thread starter Rachana
  • Start date Start date
R

Rachana

Hi,
I am having vb2003-net 1.1

Code was working fine yesterday, today getting error
-----------------------------------------------------------
error:
An unhandled exception of type 'System.Data.SqlClient.SqlException'
occurred in system.data.dll
Additional information: System error.
-----------------------------------------------------------
Last line is highlighted. error while calling method for second data
adapter
-----------------------------------------------------------
My Code is :
Dim mDataSet As New DataSet()

Dim mConn As New SqlConnection()
mConn.ConnectionString = "Data Source=localhost;initial
catalog=transport;integrated security=XXX"
mConn.Open()

Dim mStr1 As String = "select * from mItem"
Dim mStr2 As String = "select * from mPump"

Dim mAdapter1 As New SqlDataAdapter(mStr1, mConn)
mAdapter1.Fill(mDataSet, "mItem")

Dim mAdapter2 As New SqlDataAdapter(mStr2, mConn)
mAdapter2.Fill(mDataSet, "mPump")
--------------------------------------------------------------

Need help...

Thanks,
Regards,

Rachana
 
Rachana,

Probably if you remove the
mConn.Open
it will work.

The dataadapter does its own opening of the connection as long as that is
not opened already.

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top