|
-
Mar 28th, 2004, 12:21 PM
#1
Thread Starter
Lively Member
Someone please help me
i got a problem to insert my data into my Access database
i need to enter 8 data into my database using the the command like below but it give me error what is the problem ?
==============================================
Private Sub SaveDB(ByVal TableStr As String)
Dim sql = "SELECT * FROM " & TableStr
Dim MyAdapter As New OleDb.OleDbDataAdapter(sql, conn)
Dim builder As New OleDbCommandBuilder(MyAdapter)
Dim mydataset As New DataSet
MyAdapter.Fill(mydataset, TableStr)
Dim MyDataRow As DataRow = mydataset.Tables(TableStr).NewRow
MyDataRow(0) = Me.tablenumber.Text
MyDataRow(1) = Me.cname.Text
MyDataRow(2) = Me.chp.Text
MyDataRow(3) = Me.carrivetime.Text
MyDataRow(4) = Me.totcustomer.Text
MyDataRow(5) = Me.timing.Text
MyDataRow(6) = Me.day.Text
MyDataRow(7) = Me.month.Text
MyDataRow(8) = Me.year.Text
mydataset.Tables(TableStr).Rows.Add(MyDataRow)
MyAdapter.Update(mydataset, TableStr)
conn.Close()
MyAdapter = Nothing
MessageBox.Show("Data Saved..")
=========================================
is the any problem for my code ??????
or one time only can add 5 data ???
coz i delete the code until MyDataRow(5) = Me.timing.Text
and delete the 6,7,8 it can work
=========================================
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|