嵌入水晶报表visusal工作室不断提示数据库登录? [英] visusal studio embedded crystal report keeps prompting database login?

查看:132
本文介绍了嵌入水晶报表visusal工作室不断提示数据库登录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用Visual Studio 2005开发一个组合框传值到嵌入式水晶报表的参数表。我试图找出它为什么一直提示我数据库登录每一次尝试运行具有不同的组合框中选择该报告。

I'm using visual studio 2005 to develop a form with a combobox passing a value into the parameter of an embedded crystal report. I'm trying to figure out why it keeps prompting me for a database login every single time you try to run the report with a different combobox selection.

下面是我的code:

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

我看着这个previous发布<一个href="http://stackoverflow.com/questions/1132314/database-login-prompt-with-crystal-reports">http://stackoverflow.com/questions/1132314/database-login-prompt-with-crystal-reports

但这不是非常有帮助。我找不到其中CMC是要禁用提示。

but this wasn't very helpful. I couldn't find where a CMC was to disable the prompt.

任何想法?在此先感谢

推荐答案

想通了。以下行是不正确的。

figured it out. the following line was incorrect

    cryRpt.SetDatabaseLogon("KViews", "Solutions", "svr13", "subscribers")

这应该仅仅是这样的:

it should just be this:

    cryRpt.SetDatabaseLogon("KViews", "Solutions")

在登录提示不显示了。

the login prompt doesn't show up anymore.

这篇关于嵌入水晶报表visusal工作室不断提示数据库登录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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