-
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
=========================================
-
How many columns in that table in the database file ?and what does the error say ?
-
help ~~~
before got any error, inside my table got 5 field
than is tablenumber,name, handphone, arrivetime, totalcustomer and also timing.
after that i run this system, it can work
after that i add in 3 more field that is day, month and year
after that i run the system and it come up an error ~~
:( :( :( :( :(
-
First off , change the field names (day , month and year) to something else (e.g : _day , _month , _year) .
-
Hi ninjaX
Pirate is probably spot-on. (Not that I would suggest he is ever anything else) :wave: You must avoid using reserved words as column names in the database
-
thanx ~~~
:D :D :D :D
thank you
i can add my data already ~~
thanx for urs guy help