如何将Sql查询连接到Microsoft vb

时间:2016-07-26 08:53:29

标签: vb.net ssms

我已经在中的表中创建了一个sql查询,我想在vb中运行它。

这是我创建的查询。 ssms query

我想通过按钮计算来运行它 并在标签AmtDue中的ssms查询中显示AmtDue,以获取VB表单中combobox(名称)中给定名称。

这是VB表单: Vb form

vb表单的源代码。

Public Class Form1

  Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    'TODO: This line of code loads data into the 'TryDataSet2.TableTry' table. You can move, or remove it, as needed.
    Me.TableTryTableAdapter.Fill(Me.TryDataSet2.TableTry)

    End Sub

  Private Sub FillByToolStripButton_Click(sender As Object, e As EventArgs)
    Try
        Me.TableTryTableAdapter.FillBy(Me.TryDataSet2.TableTry)
    Catch ex As System.Exception
        System.Windows.Forms.MessageBox.Show(ex.Message)
    End Try

  End Sub

  Private Sub ButtonCalculate_Click(sender As Object, e As EventArgs) Handles ButtonCalculate.Click

  End Sub
End Class

当我在“TableTryTableAdapter”中添加查询时,当我运行它时,我收到了错误消息:

  

The schema returned by the new query differs from the base query.

0 个答案:

没有答案