473,322 Members | 1,781 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Connection Sql 2005 Problem

Hello,

I have create a Client - Server application.

When execute client1: all it works
When i execute "client2" while "client1" is running and using the database,
i receive this error:
<<There is already an open DataReader associated with this Command >>
I have resolved This problem with: <MultipleActiveResultSets=truein a
string connection

Now i receive another error:
<<ExecuteReader requires an open and available Connection. The connection's
current state is open>>

I receive error on this command: dataadapter.fill

Do you know why?

Thank you
May 11 '07 #1
2 1157
On 11 mayo, 09:39, "John" <j...@iol.itwrote:
Hello,

I have create a Client - Server application.

When execute client1: all it works
When i execute "client2" while "client1" is running and using the database,
i receive this error:
<<There is already an open DataReader associated with this Command >>
I have resolved This problem with: <MultipleActiveResultSets=truein a
string connection

Now i receive another error:
<<ExecuteReader requires an open and available Connection. The connection's
current state is open>>

I receive error on this command: dataadapter.fill

Do you know why?

Thank you
I supposed you are using static object incrusted in your forms. I
suggest you to use dynamic objects (created by code) to connect to a
database. You can use OLEDB, SqlClient or ODBC classes.

May 11 '07 #2
This is my code:

Public Function GetDataTable(ByVal SpName As String, ByVal Parameters() As
tpDbParameter, ByVal FillSchema As Boolean) As datatable
Dim mSqlDa As SqlDataAdapter
Dim mDtable As New Data.DataTable
Dim i As Short

'Class for connections
Dim mDbConnector As New DbConnector
mSqlConn = mDbConnector.GetSQLConnection
mDbConnector = Nothing

Dim SqlCmd As New SqlCommand(SpName, mSqlConn, mTransaction)
SqlCmd.Parameters.Clear()
SqlCmd.CommandType = CommandType.StoredProcedure

For i = 0 To Parameters.Length - 1
SqlCmd.Parameters.AddWithValue(Parameters(i).Name,
Parameters(i).Value).UdtTypeName = Parameters(i).UdtType
Next

mSqlDa = New SqlDataAdapter(SqlCmd)

Try

If FillSchema Then
mSqlDa.FillSchema(mDtable, SchemaType.Source)
End If
mSqlDa.Fill(mDtable) <----- Error in this row

Catch ex As Exception
msgbox ex.Message & vbCrLf & ex.StackTrace
Finally
mSqlDa.Dispose()
mSqlDa = Nothing
SqlCmd.Dispose()
SqlCmd = Nothing
If MustCloseConnection Then
mSqlConn.Close()
mSqlConn.Dispose()
mSqlConn = Nothing
End If
End Try

Return (mDtable)

End Function
May 11 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
by: Jon Delano | last post by:
Hey all I am building a new computer. I have Windows XP Pro with SP2 and all the updates. I installed VS 2003. Then copied a project from my old computer to the new one. When I try and run...
17
by: Danieltbt05 | last post by:
just installed SQL server 2000 and using my client , i can't locate the server. I used SQL query analyzer to search but no servers were found. Error message is as below Server : Msg17,level...
15
by: ezmiller | last post by:
Does anybody know how to use javascript to test whether or not an internet connection exists? Is this possible even?
1
by: amjad | last post by:
Hi i received that error when connection to sql server 2005 from work station . An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this...
16
by: crbd98 | last post by:
Hello All, Some time ago, I implemented a data access layer that included a simple connectin pool. At the time, I did it all by myself: I created N connections, each connection associated with...
3
by: Ted | last post by:
In WSAT, I get the following error when trying to set up my provider: Could not establish a connection to the database. If you have not yet created the SQL Server database, exit the Web Site...
20
by: fniles | last post by:
I am using VS2003 and connecting to MS Access database. When using a connection pooling (every time I open the OLEDBCONNECTION I use the exact matching connection string), 1. how can I know how...
3
by: Harry Strybos | last post by:
Hi All I have a really strange problem occurring in my application. When I read in the application settings for connection strings the following happens: Here are my connection string settings...
2
by: samadams_2006 | last post by:
Hello, I have a problem that I'm hoping someone will be able to help me resolve. 1) I have a C# Web Site in which I connect to the database: "Install Microsoft SQL Server 2005 Express...
0
by: mina | last post by:
My application which is written in vb.net 2005 uses sql server 2005 express as a database, this application is multi-user. So i am used 3 xp machine to install my application i can say...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.