Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/65.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql 为什么我的datagrid正在将数据输入数据库,而我的文本框却没有?_Mysql_Vb.net - Fatal编程技术网

Mysql 为什么我的datagrid正在将数据输入数据库,而我的文本框却没有?

Mysql 为什么我的datagrid正在将数据输入数据库,而我的文本框却没有?,mysql,vb.net,Mysql,Vb.net,这是我的密码: Imports System.Data Imports System.Data.SqlClient Public Class Form2 Private conn As New SqlConnection("Data Source=wal1sql1;Initial Catalog=ValueTracker;Integrated Security=True") Private da As New SqlDataAdapter("SELECT * FROM Va

这是我的密码:

Imports System.Data
Imports System.Data.SqlClient



Public Class Form2
    Private conn As New SqlConnection("Data Source=wal1sql1;Initial Catalog=ValueTracker;Integrated Security=True")
    Private da As New SqlDataAdapter("SELECT * FROM ValueSources", conn)
    Private ds As New DataSet
    Private cmb As New SqlCommandBuilder(da)


    'Declaration
    Public Property AllowDBNull As Boolean


    Private Sub AddNullAllowedColumn()
        Dim column As DataColumn
        column = New DataColumn("ValueSourceID", _
            System.Type.GetType("System.Int32"))
        column.AllowDBNull = True

        ' Add the column to a new DataTable. 
        Dim table As DataTable
        table = New DataTable
        table.Columns.Add(column)
    End Sub


    Private Sub ValueSourcesBindingNavigatorSaveItem_Click(sender As Object, e As EventArgs) Handles ValueSourcesBindingNavigatorSaveItem.Click
        da.UpdateCommand = cmb.GetUpdateCommand

        da.Update(ds.Tables("ValueSources"))


    End Sub

    Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Try
            da.Fill(ds, "ValueSources")

            ValueSourcesDataGridView.DataSource = ds.Tables("ValueSources")
        Catch

        End Try

        'TODO: This line of code loads data into the 'ValueTrackerDataSet.ValueSourceAvailability' table. You can move, or remove it, as needed.
        Me.ValueSourceAvailabilityTableAdapter.Fill(Me.ValueTrackerDataSet.ValueSourceAvailability)
        'TODO: This line of code loads data into the 'ValueTrackerDataSet.ValueSources' table. You can move, or remove it, as needed.
        Me.ValueSourcesTableAdapter.Fill(Me.ValueTrackerDataSet.ValueSources)
        'Me.ValueSourcesTableAdapter.GetData()

    End Sub

    Private Sub ServiceTypeIdTextBox_TextChanged(sender As Object, e As EventArgs)
    End Sub

    Private Sub BindingNavigatorAddNewItem_Click(sender As Object, e As EventArgs) Handles BindingNavigatorAddNewItem.Click

    End Sub

    Private Sub ValueSourcesBindingNavigator_RefreshItems(sender As Object, e As EventArgs) Handles ValueSourcesBindingNavigator.RefreshItems

    End Sub

    Private Sub SaveButton_Click(sender As Object, e As EventArgs) Handles SaveButton.Click
        da.UpdateCommand = cmb.GetUpdateCommand

        da.Update(ds.Tables("ValueSources"))

        MsgBox("Successfully Saved")
    End Sub

    Private Sub ValueSourceIDTextBox_TextChanged(sender As Object, e As EventArgs)

    End Sub

    Private Sub ValueSourceNameTextBox_TextChanged(sender As Object, e As EventArgs)
        da.UpdateCommand = cmb.GetUpdateCommand

        da.Update(ds.Tables("valuesources"))
    End Sub

    Private Sub ValueSourceDescriptionTextBox_TextChanged(sender As Object, e As EventArgs)
        da.UpdateCommand = cmb.GetUpdateCommand

        da.Update(ds.Tables("valuesources"))
    End Sub

    Private Sub ServiceTypeIdTextBox_TextChanged_1(sender As Object, e As EventArgs)
        da.UpdateCommand = cmb.GetUpdateCommand

        da.Update(ds.Tables("valuesources"))
    End Sub

    Private Sub UseCaseIDTextBox_TextChanged(sender As Object, e As EventArgs)
        da.UpdateCommand = cmb.GetUpdateCommand

        da.Update(ds.Tables("valuesources"))
    End Sub

    Private Sub CreateDateDateTimePicker_ValueChanged(sender As Object, e As EventArgs)
        da.UpdateCommand = cmb.GetUpdateCommand

        da.Update(ds.Tables("valuesources"))
    End Sub

    Private Sub CreateByTextBox_TextChanged(sender As Object, e As EventArgs)
        da.UpdateCommand = cmb.GetUpdateCommand

        da.Update(ds.Tables("valuesources"))
    End Sub

    Private Sub ValueSourceDescriptionTextBox_TextChanged_1(sender As Object, e As EventArgs) Handles ValueSourceDescriptionTextBox.TextChanged

    End Sub

    Private Sub ValueSourceDescriptionLabel_Click(sender As Object, e As EventArgs)

    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Me.Hide()
        MainMenu.Show()
    End Sub
End Class
我的问题是:

为什么我的datagrid可以将数据输入数据库,而我的文本框却不能

某个地方有一个断开的连接,我想不出来。

通常是这样的

da.UpdateCommand = cmb.GetUpdateCommand

da.ExecuteNonQuery