Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

to many sql

Status
Not open for further replies.

makisbest

Technical User
Mar 3, 2005
125
GR
Hi all

Dim cnConn As ADODB.Connection
Dim rs As ADODB.Recordset

Set cnConn = New ADODB.Connection
Set rs = New ADODB.Recordset

With cnConn
.Provider = "SQLOLEDB.1"
.Properties("Data Source").Value = "server"
.Properties("User ID").Value = "clroot"
.Properties("Password").Value = "clroot"
.Properties("Initial Catalog").Value = "iosif"
.CursorLocation = adUseClient
.ConnectionTimeout = 0
.Open
End With

strSQL = "select prcencd,name from salesman where slsmanstat=0 and prcencd<>001"

' **** Open Records for readonly ****
rs.Open strSQL, cnConn, adOpenStatic, adLockReadOnly

I have this code and I wont to insert more (almost 10) 'strsql' string what I must do to make this hapen??

thanks to all
 
your question is not clear.

do you wish to have more (different) "SELECT's ... from ..."?
If so you will need to do a rs.OPEN for each one of them. (and processed them accordingly).

Do you wish to extend the existing select?
If so then just type away your full SQL.
If you need to change lines you can do it two ways.
Code:
 strsql = "select ..."
 strsql = strsql & " from blabla"
 strsql = strsql & " where blabla"
or
Code:
 strsql = "select ..." &_
          " from blabla" &_
          " where blabla" &_



Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top