Programación General > Visual Basic 6.0 e inferiores
Conección A Sql Con Crystal Report
(1/1)
pacegar:
Ya tengo la coneccion al SQL de esta forma:
With BBDD
.Provider = "SQLOLEDB"
.ConnectionString = "SERVER=" + Server + ";DATABASE=" + Database + ";uid=" + User + ";pwd=" + Pass
.Open
End With
Pero a la hora de realizar la conección del Crystal Report me gustaría hacerlo de la misma forma, en tiempo de ejecucíon, y no desde diseño... ¿alguien sabe como hacerlo?
:rolleyes:
pacegar:
Esta es lo que he encontrado en la ayuda del Crystal, pero me da un error en la linea -CRXReport.Database.AddADOCommand cnn1, datcmd1- "creation feature not enabled"
¿Alguien se le ocurre algo?. Es muy importante para mi que pueda conectar los informes con el SQL directamente desde código.
Gracias a todos
--- Código: Text --- Option ExplicitDim CRXReport As New CrystalReport1 'The ADO connection to the local database. Dim cnn1 As ADODB.ConnectionDim datcmd1 As ADODB.Command 'Demonstrate the use of AddADOCommand by opening an ADO data command and adding the data source to the report. Private Sub cmdADO_Click() Dim strCnn As String 'Open the data connection. Set cnn1 = New ADODB.Connection strCnn = "Provider=SQLOLEDB;SERVER=" + Server + ";DATABASE=" + Database + ";uid=" + User + ";pwd=" + Pass cnn1.Open strCnn 'Create a new instance of an ADO command object. Set datcmd1 = New ADODB.Command Set datcmd1.ActiveConnection = cnn1 datcmd1.CommandText = "Customer" datcmd1.CommandType = adCmdTable 'Add the data source to the report. CRXReport.Database.AddADOCommand cnn1, datcmd1End Sub
Navegación
Ir a la versión completa