|
-
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
=========================================
-
Mar 28th, 2004, 12:53 PM
#2
Sleep mode
How many columns in that table in the database file ?and what does the error say ?
-
Mar 28th, 2004, 01:58 PM
#3
Thread Starter
Lively Member
-
Mar 28th, 2004, 02:28 PM
#4
Sleep mode
First off , change the field names (day , month and year) to something else (e.g : _day , _month , _year) .
-
Mar 28th, 2004, 04:46 PM
#5
PowerPoster
Hi ninjaX
Pirate is probably spot-on. (Not that I would suggest he is ever anything else) You must avoid using reserved words as column names in the database
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
Mar 29th, 2004, 02:17 AM
#6
Thread Starter
Lively Member
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
|