我已经黔驴技穷了。我构建的应用程序可以在我的系统上完美运行,但不能在其他任何人上运行。这非常简单,在加载时它会向用户查询批号,然后过滤数据以在 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
我没有收到任何错误,它只是没有填充数据集。我的第一个想法是连接字符串不好。那里没有问题。任何建议将不胜感激。
谢谢你。