Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 addadocommand with sql server 2000

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-08-07 : 09:28:35
ben alaya mohsen writes "dear sir,

i'am trying to create a dynamic report with crystal report 8.0 devlopper version but i couldn't find any example using sql server 2000 database.

i want to pass an sql string with the

adoaddcommand pconnection,padocommand

my code is looking like this :

Private Sub cmdADO_Click()
Dim fld As FieldObject
Dim strCnn As String

' Open the data connection
Set cnn1 = New ADODB.Connection
strCnn = "Provider=SQLOLEDB.1;UID=sa;PWD=password;User ID=sa;Initial Catalog=databasename;DataSource=servername"

cnn1.Open strCnn

' Create a new instance of an ADO command object
Set datcmd1 = New ADODB.Command
Set datcmd1.ActiveConnection = cnn1
datcmd1.CommandText = "select * from TableName"
datcmd1.CommandType = adCmdText

' Add the datasource to the report
m_Report.Database.AddADOCommand cnn1, datcmd1
' Add a new field object to the report and set the field object to use
' the new data source.
Set fld = m_Report.Section3.AddFieldObject("{ado.TableName FieldName}", 0, 0)
LoadReport
End Sub

but i got a runtime error : argment ou appel de procedure incorrect

this message is in french because i have vb 6 french edition

can you help me to find a way for working with sql server 2000 database, if you can send a little sample i would be greatful

sincerely ben alaya mohsen."
   

- Advertisement -