VB Application在我的计算机上连接到服务器,但在任何其他计算机上都没有

时间:2012-10-26 20:28:41

标签: vb.net visual-studio-2010 visual-studio sql-server-2008

我在我的智慧结束。我构建的应用程序在我的系统上完美运行,但不适用于任何人。它非常简单,在加载时它会向用户查询批号,然后过滤数据以仅在datagridview中显示具有该批号的项目。

这是我写的代码:

'*******************************************************************************************************************************
' When the form loads, the following code opens a inputbox that asks the user for a batch number. This number then gets used
' to filter the data before populating the DataGridView
'*******************************************************************************************************************************
Private Sub frmAQFilter_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
    Me.DataTable1TableAdapter.Fill(Me.ElementDataset.qryAQFilterData)

    Dim blnX As Boolean = True
    Dim msg As Integer

    Do While blnX
        strBatch = ""
        strBatch = InputBox("Batch Number: ")

        If Len(strBatch) > 0 Then
            DataTable1BindingSource.Filter = String.Format("Batch = '" & strBatch & "'")
            If Not DataTable1BindingSource.Count > 0 Then
                msg = MsgBox("No records found with the batch number: " + strBatch + Chr(13) _
                             + "Do you wish to enter a different batch number", MsgBoxStyle.YesNo)
                If msg = vbNo Then
                    Me.Close()
                    blnX = False
                End If
            Else
                blnX = False
            End If
        Else
            Me.Close()
            blnX = False
        End If
    Loop
    Me.WindowState = FormWindowState.Normal
End Sub

我没有收到任何错误,它只是没有填充数据集。我的第一个想法是连接字符串很糟糕。没有问题。任何建议都将不胜感激。

谢谢。

2 个答案:

答案 0 :(得分:0)

禁用防火墙。还尝试在vb.net中设置SQL Server的网络地址,以便为两个客户端使用单个外部SQL服务器。我想这会帮助我们知道在哪里调查。

答案 1 :(得分:0)

感谢您尝试帮助我。事实证明问题不是我的代码。当我的计算机上安装了Visual Studio时,它安装不正确导致它生成损坏的64位版本而不是32位版本。非常恶化,但问题得到纠正。