Home > Net >  Excuse me, in the 2019 vb.net DataRowds this thing on earth?
Excuse me, in the 2019 vb.net DataRowds this thing on earth?

Time:11-10

Specific code is as follows:
Public Class Form1
Private Sub Button1_Click (sender As Object, As EventArgs e) Handles for. Click
Dim con As MySql. Data. MySqlClient. MySqlConnection
Dim da As MySql. Data. MySqlClient. MySqlDataAdapter
Dim ds As the DataSet
. Con=New MySql Data. MySqlClient. MySqlConnection
Con. The ConnectionString="*; Port=10156; The database=*; UID=*; The PWD=*
"Con. The Open ()
Dim conm As New MySql. Data. MySqlClient. MySqlCommand (" select * from SPRXQ ", con)
Ds=New DataSet
Da. The Fill (ds, "cpyxq")
Dim the Dr As DataRow
Dr=ds. Tables (" cpyxq "). The NewRow ()
Dr (" goods ")=TextBox1. Text
Dr (" name ")=TextBox2. Text
Dr (" production date ")=TextBox3. Text
Dr (" warranty ")=TextBox4. Text
Dr (" date ")=TextBox5. Text
Dr (" status ")=TextBox6. Text
Ds. Tables (" sqyxq "). The Rows. The Add (Dr)
Dim SCD As New MySql. Data. MySqlClient. MySqlCommandBuilder (da)
Da. Update (ds, "cpyxq")
DataGridView1. The DataSource=ds. The Tables (" spyxq ")
Con. The Close ()

End Sub

Private Sub DataGridView1_CellContentClick (sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView1. CellContentClick
If "e.R owIndex & lt; DataGridView1. Rows. Then Count - 1
TextBox1. Text=DataGridView1. Rows (" e.R owIndex), Cells (1). The Value. The ToString ()
TextBox2. Text=DataGridView1. Rows (" e.R owIndex), Cells (2). The Value. The ToString ()
TextBox3. Text=DataGridView1. Rows (" e.R owIndex), Cells (3). The Value. The ToString ()
TextBox4. Text=DataGridView1. Rows (" e.R owIndex), Cells (4). The Value. The ToString ()
TextBox5. Text=DataGridView1. Rows (" e.R owIndex), Cells (5). The Value. The ToString ()
TextBox6. Text=DataGridView1. Rows (" e.R owIndex), Cells (6). The Value. The ToString ()
End the If

End Sub

Private Sub Button2_Click (sender As Object, As EventArgs e) Handles Button2. Click
Dim con As MySql. Data. MySqlClient. MySqlConnection
Dim da As MySql. Data. MySqlClient. MySqlDataAdapter
Dim ds As the DataSet
. Con=New MySql Data. MySqlClient. MySqlConnection
Con. The ConnectionString="server=*; Port=10156; The database=*; UID=*; The PWD=*
"Con. The Open ()
Da=New MySql. Data. MySqlClient. MySqlDataAdapter (" SELECT * From cpyxq ", con)
Ds=New DataSet
Da. The Fill (ds, "cpyxq")
Dim the Dr As DataRowds. DataTables (" cpyxq "). The PrimaryKey=New DataColumn () {ds. The Tables (" cpyxq "). The Columns (" record the serial number ")}
Dr=DataRowds. DataTables (" cpyxq ").)
Dr (" goods ")=TextBox1. Text
Dr (" name ")=TextBox2. Text
Dr (" production date ")=TextBox3. Text
Dr (" warranty ")=TextBox4. Text
Dr (" date ")=TextBox5. Text
Dr (" status ")=TextBox6. Text
Dim SCD As New MySql. Data. MySqlClient. MySqlCommandBuilder (da)
Da. Update (ds, "cpyxq")
DataGridView1. The DataSource=ds. The Tables (" cpyxq ")
Con. The Close ()
End Sub
The error is DataRowds dataTables (" cpyxq ") this code "is undefined type" and DataRowds. DataTables (" cpyxq ") "did not declare DataRowds", I am strange, this code basically all is by the book, then according to their own needs to do slight adjustment, how the error?
The End of the Class

CodePudding user response:

No newline books

Dim the Dr As DataRow
Ds. DataTables (" cpyxq "). The PrimaryKey=New DataColumn () {ds. The Tables (" cpyxq "). The Columns (" record the serial number ")}

CodePudding user response:

Copy to the code, the first floor), no branch

CodePudding user response:

Obviously a DataRow ds two,

CodePudding user response:

Upstairs right is not a thing is two things
  • Related