Re: SQLCeConnection
- From: "Ginny Caughey [MVP]" <ginny.caughey.online@xxxxxxxxxxxxxx>
- Date: Tue, 21 Nov 2006 14:34:16 -0500
When you have a DataReader open and you've issued a Read command, you don't
need ExecuteNonQuery to get data. Just use objDataReader.GetString(0) to get
the first column's data, etc.
--
Ginny Caughey
Device Application Development MVP
<amiga500@xxxxxxxxx> wrote in message
news:1164127121.034683.262880@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Oh God thank you guys for everything you have done. That really solved
the delima of what is the point for the SQLCe all together. Phew, that
made life easier.
However, I just need one more advice and I am set for sure.
This is the code below for the pocketpc:
Dim objConn As SqlConnection = Nothing
Dim objEngine As SqlCeEngine = Nothing
Dim objComm As New SqlCommand
Dim objDataReader As SqlDataReader = Nothing
Dim txtItemNumber As String
'Dim objDrItems As SqlCeDataAdapter
'"User ID=DSUSER;PASSWORD=silentk;Data
Source=NTSERVER-2;Initial
'Catalog=Direct Source System;Persist Security
Info=False;Packet
'Size=4096"
'objEngine.LocalConnectionString = "Data Source=NTSERVER-2"
'objEngine.CreateDatabase()
'objEngine = New SqlCeEngine("User
ID=DSUSER;PASSWORD=silentk;Data Source=NTSERVER-2;Initial
Catalog=Direct Source System;Persist Security Info=False;Packet
Size=4096")
'objEngine.CreateDatabase()
'objEngine.Dispose()
' 10.12.0.8
Try
objConn = New SqlConnection("User
ID=DSUSER;PASSWORD=silentk;Data Source=10.12.0.8;Initial Catalog=Direct
Source System;Persist Security Info=False;Packet Size=4096")
objComm.CommandText = "SELECT * FROM Products"
objComm.CommandType = CommandType.Text
objConn.Open()
objComm = New SqlCommand(objComm.CommandText, objConn)
objDataReader = objComm.ExecuteReader
Catch
MsgBox(Err.Description)
End Try
Try
While objDataReader.Read = True
txtItemNumber = objComm.ExecuteNonQuery
End While
objConn.Close()
Catch
MsgBox(Err.Description)
End Try
MsgBox(txtItemNumber)
I get an error exactly right here:
objDataReader = objComm.ExecuteReader
on the above line it says:
"There is already an open DataReader associated with this Connection or
Command which must be closed first."
But it makes absolutely no sense since I just started opening the file.
What does that mean?
.
- Follow-Ups:
- Re: SQLCeConnection
- From: amiga500
- Re: SQLCeConnection
- References:
- SQLCeConnection
- From: amiga500
- Re: SQLCeConnection
- From: Erik Visser
- Re: SQLCeConnection
- From: amiga500
- Re: SQLCeConnection
- From: Ginny Caughey [MVP]
- Re: SQLCeConnection
- From: amiga500
- Re: SQLCeConnection
- From: Ginny Caughey [MVP]
- Re: SQLCeConnection
- From: amiga500
- Re: SQLCeConnection
- From: Pete Vickers
- Re: SQLCeConnection
- From: amiga500
- Re: SQLCeConnection
- From: Ginny Caughey [MVP]
- Re: SQLCeConnection
- From: amiga500
- SQLCeConnection
- Prev by Date: Re: SQLCeConnection
- Next by Date: Re: SQLCeConnection
- Previous by thread: Re: SQLCeConnection
- Next by thread: Re: SQLCeConnection
- Index(es):
Relevant Pages
|
|