用于VS 2005的Visual Basic .NET 2005 / Crystal Reports [英] Visual Basic .NET 2005 / Crystal Reports for VS 2005

查看:83
本文介绍了用于VS 2005的Visual Basic .NET 2005 / Crystal Reports的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我已经查看了许多可用资源(在2005年之前的VB中编写),但没有找到任何正常工作的资源。以下是我的问题...

目前,我使用VB 6.0 ...及其数据报告来制作报告。使用该数据报告,您可以向其添加将连接到数据库的代码...运行自定义SQL语句....等等。以下是代码的摘录:

----- -----
Private Sub DataReport_Initialize()
'调整使用的变量。
Dim strSQL As String'SQL String。
Dim oConn As New ADODB.Connection'New ADODB Connection。
Dim oRS As New ADODB.Recordset'New ADODB Recordset
Dim BarCode As String
Dim i As Integer
Dim o As Integer
'Me.Orientation = rptOrientLandscape
'连接字符串
oConn.CursorLocation = adUseClient
oConn.ConnectionString =" Provider = MSDASQL; DRIVER = {MySQL ODBC 3.51驱动程序}; SERVER = 192.168.50.4; DATABASE = MaterialBarcode_Database; UID =用户; PASSWORD =合格; OPTION = 3英寸'连接字符串。
oConn.Open
strSQL =" SELECT *"
strSQL = strSQL& " FROM tblBaywatch"
strSQL = strSQL& "ORDER BY Location ASC"

'正在连接...
如果oRS.State = adStateOpen那么oRS.Close
oRS.Open strSQL,oConn,adOpenForwardOnly
'连接已发生。
设置Me.DataSource = oRS
Me.Sections(" Section4")。Controls.Item(" lblRecordCount")。Caption = oRS.RecordCount& "找到的材料。"
End Sub
----------正如你所看到的,我的数据库后端是MySQL。有没有办法做到这一点?另一种情况可能包括如下的SQL语句:

strSQL =" SELECT * FROM tblBaywatch WHERE Date BETWEEN'" &安培; frmMain.StartDate& "'& frmMain.EndDate& "'"

上面会在设置语句时将表单中设置的数据添加到SQL语句中。



解决方案

任何人?在我看来,Crystal Reports for VS.NET 2005应该能够做一些像我要求的那样简单的事情,但我仍然无法找到答案。结果

Hello, I have looked at many of the resources available (written in a pre 2005 VB), but have not found anything that works right.  Below is my problem...

Currently, I use VB 6.0...and its Data Reports for making a report.  With that data report, you can add code to it that will connect to a database...run a custom SQL statement....etc etc. Below is an excerpt of code:

----------
Private Sub DataReport_Initialize()
'Dimming of variables used.
Dim strSQL As String    'SQL String.
Dim oConn As New ADODB.Connection   'New ADODB Connection.
Dim oRS As New ADODB.Recordset  'New ADODB Recordset
Dim BarCode As String
Dim i As Integer
Dim o As Integer
'Me.Orientation = rptOrientLandscape
'Connection string
oConn.CursorLocation = adUseClient
oConn.ConnectionString = "Provider=MSDASQL; DRIVER={MySQL ODBC 3.51 Driver}; SERVER=192.168.50.4; DATABASE=MaterialBarcode_Database; UID = User; PASSWORD=Pass; OPTION=3"  'Connection String.
oConn.Open
        strSQL = "SELECT * "
        strSQL = strSQL & "FROM tblBaywatch "
        strSQL = strSQL & "ORDER BY Location ASC "
    'Connecting...
    If oRS.State = adStateOpen Then oRS.Close
oRS.Open strSQL, oConn, adOpenForwardOnly
'Connection made.
Set Me.DataSource = oRS
Me.Sections("Section4").Controls.Item("lblRecordCount").Caption = oRS.RecordCount & " materials found."
End Sub
----------

As you can see, my database backend is MySQL.  Is there a way to do the above?  Another situation might include an SQL statement like the following:

strSQL = "SELECT * FROM tblBaywatch WHERE Date BETWEEN '" & frmMain.StartDate & "' & frmMain.EndDate & "'"

The above will add data that is set in a form to the SQL statement when the statement is set.




解决方案

Anyone? It seems to me that Crystal Reports for VS.NET 2005 should be able to do something as simple as what i'm asking, but I still have no been able to find an answer.     


这篇关于用于VS 2005的Visual Basic .NET 2005 / Crystal Reports的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆