Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/16.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xslt/3.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
Vb.net 数据适配器/集合代码vbasic末尾出现未知语法错误 您的语法错误与代码不匹配?您所说的“代码结束”是什么意思?BtnExitSave_Click?这是一个SQL错误,显示您想要运行的任何查询的代码。 Public Class Form4 Dim sql_Vb.net_Visual Studio 2010 - Fatal编程技术网

Vb.net 数据适配器/集合代码vbasic末尾出现未知语法错误 您的语法错误与代码不匹配?您所说的“代码结束”是什么意思?BtnExitSave_Click?这是一个SQL错误,显示您想要运行的任何查询的代码。 Public Class Form4 Dim sql

Vb.net 数据适配器/集合代码vbasic末尾出现未知语法错误 您的语法错误与代码不匹配?您所说的“代码结束”是什么意思?BtnExitSave_Click?这是一个SQL错误,显示您想要运行的任何查询的代码。 Public Class Form4 Dim sql,vb.net,visual-studio-2010,Vb.net,Visual Studio 2010,数据适配器/集合代码vbasic末尾出现未知语法错误 您的语法错误与代码不匹配?您所说的“代码结束”是什么意思?BtnExitSave_Click?这是一个SQL错误,显示您想要运行的任何查询的代码。 Public Class Form4 Dim sql As String 'Declaring sql as a string Dim con As New OleDb.OleDbConnection

数据适配器/集合代码vbasic末尾出现未知语法错误
您的语法错误与代码不匹配?您所说的“代码结束”是什么意思?BtnExitSave_Click?这是一个SQL错误,显示您想要运行的任何查询的代码。
Public Class Form4

Dim sql As String                                   'Declaring sql as a string
Dim con As New OleDb.OleDbConnection                'Declaring con as a new connection
Dim da As OleDb.OleDbDataAdapter                    'Declaring da as a data adapter
Dim ds As New DataSet                               'Declaring ds as a new data set
Dim Inc As Integer                                  'Declaring inc As an integer
Dim Maxrows As Integer                              'Declaring maxrows as an integer

'inside of the connection, i have to fill the dataset, and then fill the adapter with the dataset
Private Sub Form4_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    con.ConnectionString = "PROVIDER = Microsoft.Jet.OLEDB.4.0; Data Source = C:\Users\MadMaxHarl\Desktop\Thespellingbee\Resources\Spelling Bee1.mdb"   'States where the database is, as well as the provider
    con.Open()                                          'Opens the connection
    sql = "SELECT * FROM [WordsDefinitions] [WD]"       'The sql string is filled with the data from the table "Words + Definitions"
    da = New OleDb.OleDbDataAdapter(sql, con)           'Makes da a new data adapter containing the connection and the sql string
    da.Fill(ds, "WD")
    con.Close()                                         'Closes the connection
    Maxrows = ds.Tables("WD").Rows.Count
    Inc = -1
End Sub

Private Sub navigaterecords()
    txtword.Text = ds.Tables("WD").Rows(Inc).Item(1)
    Txtdescription.Text = ds.Tables("WD").Rows(Inc).Item(2)
End Sub

Private Sub BtnBack_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnBack.Click
    If inc > 0 Then
        Inc = Inc - 1
        navigaterecords()
    Else
        MsgBox("First Record")
    End If
End Sub

Private Sub BtnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnNext.Click
    If Inc <> Maxrows - 1 Then
        Inc = Inc + 1
        navigaterecords()
    Else
        MsgBox("No More Rows")
    End If
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
    If Inc <> Maxrows - 1 Then
        Inc = Maxrows - 1
        navigaterecords()
    End If
End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
    If Inc <> 0 Then
        Inc = 0
        navigaterecords()
    End If
End Sub

Private Sub BtnExitSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnExitSave.Click
    Dim cb As New OleDb.OleDbCommandBuilder(da)         'Command builder needed to change database, stored data adapter in the variable cb

    ds.Tables("WD").Rows(Inc).Item(1) = txtword.Text
    ds.Tables("WD").Rows(Inc).Item(2) = Txtdescription.Text

    da.Update(ds, "WD")

    MsgBox("It's working", MessageBoxButtons.OK)
End Sub

End Class
   Word Number  Word    Description
   1        Hectare         Unit Of Area
   2        Active          Being Busy
   3        Amaze           Surprise
    4       Bound           Leap And Jump
   5        Cavern          A Large Cave
   6        Difficult           Hard To Do
   7        Frozen          Turned To Ice
   8        Garage          Building For A Car
   9        Jaguar          Large Cat
   10       Lemonade            Fizzy Drink