我使用Visual Studio 2005开发具有传入一个值嵌入水晶报表的参数组合框的形式。 我试图找出它为什么不断提示我数据库登录您尝试运行用不同的组合框中选择该报告每一次。
这里是我的代码:
private Sub Form1_load...
Dim ConnName As String
Dim ServerName As String
Dim DBName As String
Dim user As String
Dim pass As String
Dim gDBA As ADODB.Connection
Dim records As ADODB.Recordset
Dim datver As ADODB.Recordset
Dim query As String
'---OPEN THE DATABASE CONNECTIONS
gDBA = New ADODB.Connection ': gDBA.CursorLocation = adUseServer
'Added to prevent time out error
gDBA.CommandTimeout = 1000 : gDBA.ConnectionTimeout = 1000
gDBA.ConnectionString = "Server=svr13;Database=subscribers;User ID=KViews;Password=Solution;Trusted_Connection=True;"
gDBA.Open("Data Source=Kaseya;Initial Catalog=subscribers;User Id=KViews;Password=Solution;", "KViews", "Solution")
records = New ADODB.Recordset
query = "select distinct groupname from _v_k order by groupname desc"
'records.ActiveConnection = gDBA.ConnectionString
records.CursorType = CursorTypeEnum.adOpenForwardOnly
records.LockType = LockTypeEnum.adLockReadOnly
records.Open(query, gDBA)
Do While Not records.EOF
ComboBox1.Items.Add(records.Fields("groupname").Value)
records.MoveNext()
Loop
end Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim selected As String
selected = ComboBox1.Text
Dim cryRpt As New ReportDocument
cryRpt.Load("C:\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplication1\CrystalReport1.rpt")
cryRpt.SetDatabaseLogon("KViews", "Solutions", "svr13", "subscribers")
cryRpt.SetParameterValue("companyname", selected)
CrystalReportViewer1.ReportSource = cryRpt
CrystalReportViewer1.Refresh()
End Sub
我看着这个以前发布用水晶报表的数据库登录提示
但是这是不是非常有帮助。 我找不到一个地方CMC是禁用提示。
有任何想法吗? 提前致谢