I've been having 'lots of' troubles connecting my Visual Basic Crystal Report with an SQL Server 2000. Just today, after finishing some minor details on the code, I ran the program and it worked. But then I had to renamed a table on the DB and it started to give me an error that the (prior) table couldn't be found in the server. After awhile, I decided to rebuilt my VB CR from scratch... and now it still doesn't work. I'm getting kinda upset 'cause it's a part of a project that needs to be finished by 28/02/02. (this is one of five reports that need to be working)
Could anyone help me on this one. The code I used is the following:
Private Sub Form_Load()
Dim strSQL As String
Dim comando As String
strSQL = "SELECT " & _
"OBRA.FObraID, OBRA.fo_DataCriacao, OBRA.fo_horainicio, OBRA.fo_tecnicoID, " & _
"OBRA.fo_clienteID, OBRA.fo_kms, CLMES.NOME, CLMES.MORADA1, CLMES.TEL, " & _
"EPMES.NOME, Veiculo.veic_matricula, Veiculo.veic_codImob, OBRAITEM.ItemID, " & _
"OBRAITEM.descr, OBRAITEM.qtd, OBRAITEM.custo, OBRAITEM.codbarras, " & _
"Versao.versao_nome, Marca.marca_nome, Modelo.model_nome, CPOST.COD, CPOST.DESIG " & _
"From " & _
"TESTES.dbBRA, TESTES.dbo.CLMES, TESTES.dbo.EPMES, TESTES.dbo.Veiculo, " & _
"TESTES.dbBRAITEM, TESTES.dbo.Versao, TESTES.dbo.Marca, TESTES.dbo.Modelo, " & _
"TESTES.dbo.CPOST"
comando = "uid=agenda; pwd=testes; driver={SQL Server}; server=sql2000; database=TESTES; dsn= , ,connection=adConnectAsync"
Set Conn = New ADODB.Connection
Conn.Open comando
Set rec = New ADODB.Recordset
rec.Open strSQL, Conn, adOpenStatic, adLockReadOnly
Report.Database.LogOnServer "p2ssql.dll", "Sql2000", "TESTES", "agenda", "testes"
Screen.MousePointer = vbArrowHourglass
CRViewer1.ReportSource = Report
CRViewer1.ViewReport
Screen.MousePointer = vbDefault
End Sub
My thanks to anyone who can give me a hand on this.
Could anyone help me on this one. The code I used is the following:
Private Sub Form_Load()
Dim strSQL As String
Dim comando As String
strSQL = "SELECT " & _
"OBRA.FObraID, OBRA.fo_DataCriacao, OBRA.fo_horainicio, OBRA.fo_tecnicoID, " & _
"OBRA.fo_clienteID, OBRA.fo_kms, CLMES.NOME, CLMES.MORADA1, CLMES.TEL, " & _
"EPMES.NOME, Veiculo.veic_matricula, Veiculo.veic_codImob, OBRAITEM.ItemID, " & _
"OBRAITEM.descr, OBRAITEM.qtd, OBRAITEM.custo, OBRAITEM.codbarras, " & _
"Versao.versao_nome, Marca.marca_nome, Modelo.model_nome, CPOST.COD, CPOST.DESIG " & _
"From " & _
"TESTES.dbBRA, TESTES.dbo.CLMES, TESTES.dbo.EPMES, TESTES.dbo.Veiculo, " & _
"TESTES.dbBRAITEM, TESTES.dbo.Versao, TESTES.dbo.Marca, TESTES.dbo.Modelo, " & _
"TESTES.dbo.CPOST"
comando = "uid=agenda; pwd=testes; driver={SQL Server}; server=sql2000; database=TESTES; dsn= , ,connection=adConnectAsync"
Set Conn = New ADODB.Connection
Conn.Open comando
Set rec = New ADODB.Recordset
rec.Open strSQL, Conn, adOpenStatic, adLockReadOnly
Report.Database.LogOnServer "p2ssql.dll", "Sql2000", "TESTES", "agenda", "testes"
Screen.MousePointer = vbArrowHourglass
CRViewer1.ReportSource = Report
CRViewer1.ViewReport
Screen.MousePointer = vbDefault
End Sub
My thanks to anyone who can give me a hand on this.