⑴ 水晶報表如何寫sql 命令
'Orders' on 'Customer'.'Customer ID' = 'Orders'.'Customer ID' 裡面w我看見了;這個符號
⑵ 水晶報表中的SQL語句該怎麼寫呢
不能這么弄。得你提前用程序將Sql文寫好。交給數據記錄集,查詢出的數據結果賦給報表。不能直接在報表中寫。這樣寫也是有條件的。必須低版本水晶報表才支持。但是寫的話 不可能引入變數.
⑶ 水晶報表中的sql表達式欄位怎麼用
水晶報表中的sql表達式欄位有點和sql語句中的別名欄位差不多。
舉個例子先:Select f1,f2,f3,(f4+f5) as xx from table1
那麼sql表達式欄位可以是f1,f2,f3或者是f4+f5
在運用sql表達式欄位的時候,首先需要了解報表當前使用的sql語句,然後select*,([sql表達式欄位]裡面的內容)from table1執行成功。
⑷ 在VB中使用水晶報表,如何利用SQL語句改變報表的數據源
首先引用Crystal Reports 9 ActiveX Designer Run Time Library
再添加Crystal Repotr View Control 9控制項
在工程資源管理器中右鍵--添加--Crystal Reports 9 新建一個Crystal Reports9報表
設置數據源後將要顯示的欄位加入報表內。
窗體代碼部分:
Dim m_Report As New CrystalReport1 \'(這個CrystalReport1是你建立的報表的名稱)
Dim m_Connection As ADODB.Connection \'(建立一個ADO連接)
Dim adoRS As ADODB.Recordset
Private Sub Form_Load()
Dim SQL As String
Dim strConnect As String
\' Create and bind the ADO Recordset object
Set m_Connection = New ADODB.Connection
Set adoRS = New ADODB.Recordset
\' Open the connection
strConnect = "你的資料庫連接字元串"
m_Connection.Open strConnect
SQL = "查詢語句"
adoRS.Open SQL, m_Connection, adOpenDynamic, adLockBatchOptimistic
m_Report.Database.SetDataSource adoRS\'(動態設置報表數據源)
Screen.MousePointer = vbHourglass
CRViewer1.ReportSource = m_Report
CRViewer1.ViewReport \'(顯示報表)
Screen.MousePointer = vbDefault
End Sub
此代碼在VB6+SP5+Windows2000 Server下調試通過
以上代碼參考水晶報表9中文版