View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
AA2e72E AA2e72E is offline
external usenet poster
 
Posts: 400
Default Several sql queries with the same recordset

Refer to the code in your original query .... relevant part pasted here (see
line 2):

If (Range("B" & i).Value 0) Then
rs.Open mySql4, cn, adOpenStatic
rs.Close
Else
rs.NextRecordset mySql3, cn, adOpenStatic
rs.Close
End If

cn in this context is either an ADODB.Connection object that has been opened
or it is simply a string that can be used to connect to the databas,
something like:

cn="DSN=your DSN;UID=your userid;PWD=your password"

"fbonnard" wrote:


When you said

set Cnn=New ADODB.Connection
Cnn.Open Cn
Cnn.Execute sql ' your SQLS starting UPDATE (does not return a record
set)
Cnn.Execute sql ' your SQLS starting INSERT (does not return a record
set)


What is cn ?

How can i use RecordCount and CopyFromRecordset if i need to make a
select ?


--
fbonnard
------------------------------------------------------------------------
fbonnard's Profile: http://www.excelforum.com/member.php...o&userid=15977
View this thread: http://www.excelforum.com/showthread...hreadid=274467