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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crystal conecction with remote SQL Server

Status
Not open for further replies.

rosi02

Programmer
Feb 7, 2002
3
0
0
AR
Hi!

I'm using Crystal Report 8.0, SQL Server 7.0, Visual C++ 6.0, Crystal Activex (Crystl32.OCX) with Win NT 4.0.
I'm using a database in a remote SQL Server. I created an ODBC connection and used it to connect the report with the database.
The problems is that: I'm calling this report in a Visual C++ 6.0 using de Activex and I can't refresh this report (saving data with report). If I don't save data with report, the report flash up.

If I do the same issues with the database in the same server that I run de report, the refresh is OK. Then, I'm thinking that I configuring the connection with the SQL Server in a wrong way.

Somebody can help me?

Thanks in advance.
rosi02
 
I supose so, but I don't know how resolve it. Do you have any idea?
I established the connection in differents ways, and I had the same result.

Thank you
rosi02
 
I resolved the problems, it were SQL user permissions.

Thank you
rosi02
 
You could also have solved it by, for each table, using the Connect method to pass the server logon info and then using the Location property to pass the server.dbo info.

h.
 
I'm using Crystal Report 8.0, SQL Server 7.0, Visual basic 6.0, Crystal Activex (Crystl32.OCX) with 98 sec2


=======================================================
Dim Report As New CrystalReport1
Dim conn As New ADODB.Connection
Dim RS As New ADODB.Recordset

Private Sub Form_Load()
On Error GoTo Err

Dim yea

yea = Left(Form1.date1, 4)


serno1 = Form1.serfrom.Text
serno2 = Form1.serto

conn.CommandTimeout = 30
==============================
conn.Open "Provider=sqloledb;Network Library=DBMSSOCN;Data Source=192.168.0.2,1433;Initial Catalog=cms;User ID=Sa;Password=123;"
===========================================
SQL = "select inport.serno,inport.serdate,inport.idmamah,inport.obj, import.name1 as imnames,typem.name1 as tynames,manag.name1 FROM inport,manag,import,typem "
SQL = SQL & "where inport.idmanag = manag.idmanag and inport.idimport =import.idimport and inport.idtype = typem.idtype "
SQL = SQL & " and inport.seryear = '" & yea & "'"
SQL = SQL & " and inport.serno between " & serno1 & " and " & serno2


RS.Open SQL, conn, 3

If RS.RecordCount > 0 Then
========================
Report.Database.Tables.Item(1).SetLogOnInfo "192.168.0.2", "cms", "sa", "123"
==================================
Report.Database.SetDataSource RS








Report.SQLQueryString = SQL

Screen.MousePointer = vbHourglass
Report.Text1.SetText Report.Text1.Text & "dd"
Report.PrintOut False, 1, False



CRViewer1.ReportSource = Report

CRViewer1.ViewReport




Screen.MousePointer = vbDefault
Else


MsgBox "áÇíæÌÏ ÈíÇäÇÊ", vbOKOnly, "áÇíÓÊØíÚ ÇáÈÑäÇãÌ ÝÊÍ ÇáÊÞÑíÑ"
Form2.Visible = False
Form2.Hide
End If
RS.Close
conn.Close

Exit Sub

Err:
MsgBox Err.Number & " " & Err.Description, vbOKOnly, "ÍÕá ÇáÎØÇ ÇáÊÇáí:"
RS.Close
conn.Close
Exit Sub

End Sub
 
Your code is not using the OCX.

You don't need to do a .SetLogonInfo if you are passing a recordset to the report.
 
Could someone pls tell me what codes to include to run a CR with stored procedures in Visual C++? I think the codes like this

CRXTable.SetLogOnInfo "Server", "Database", "User Id", "User pw'

but where can i find the declaration of CRXtable?? Which header file will that be?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top