| | |
Need Help to insert data to MS Access table
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
I been searching for days for a sulotion but can't seem to find one.
The coed that I have does not give me an error but it does not save anything on the table either '
Can someone help me find what I'm missing?
this is my coed
Thank you
Viper
The coed that I have does not give me an error but it does not save anything on the table either '
Can someone help me find what I'm missing?
this is my coed
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
Dim mycon As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\DEsign.accdb" Dim customer As String = "select * from Customer_tbl" Dim Notes As String = "select * from Notes_tbl" Dim con As New OleDb.OleDbConnection(mycon) Dim comCustomer As New OleDb.OleDbCommand(customer, con) Dim comdNotes As New OleDb.OleDbCommand(Notes, con) Dim Custsql As String = "first name,Last Name" Dim Sql As String = "insert into Customer_tbl (Custsql )values '" & txtFirstName.Text & "','" & txtLastName.Text & "')" comCustomer = New OleDb.OleDbCommand(Sql, con) con.Open() comCustomer.ExecuteNonQuery() comCustomer.Dispose() con.Close()
Viper
i don't think that is VB 6.0 code.
if vb 6.0 then try this
if vb 6.0 then try this
vb Syntax (Toggle Plain Text)
Dim Sql As String = "insert into Customer_tbl (Custsql )values '" & txtFirstName.Text & "','" & txtLastName.Text & "')" con.begintrans 'con-----ADODB connection object. con.execute sql con.committrans
Share your Knowledge.
•
•
•
•
i don't think that is VB 6.0 code.
if vb 6.0 then try this
vb Syntax (Toggle Plain Text)
Dim Sql As String = "insert into Customer_tbl (Custsql )values '" & txtFirstName.Text & "','" & txtLastName.Text & "')" con.begintrans 'con-----ADODB connection object. con.execute sql con.committrans
when I try the coed I get an error that execute and committrans are not members of the OLEDB.
I'm using Acess 2007 as a Database. Hope this helps.
Thanks
•
•
Join Date: Mar 2009
Posts: 841
Reputation:
Solved Threads: 153
•
•
•
•
I been searching for days for a sulotion but can't seem to find one.
The coed that I have does not give me an error but it does not save anything on the table either '
Can someone help me find what I'm missing?
this is my coed
Thank youDim mycon As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\DEsign.accdb" Dim customer As String = "select * from Customer_tbl" Dim Notes As String = "select * from Notes_tbl" Dim con As New OleDb.OleDbConnection(mycon) Dim comCustomer As New OleDb.OleDbCommand(customer, con) Dim comdNotes As New OleDb.OleDbCommand(Notes, con) Dim Custsql As String = "first name,Last Name" Dim Sql As String = "insert into Customer_tbl (Custsql )values '" & txtFirstName.Text & "','" & txtLastName.Text & "')" comCustomer = New OleDb.OleDbCommand(Sql, con) con.Open() comCustomer.ExecuteNonQuery() comCustomer.Dispose() con.Close()
Viper
Insert Into Table Values (Field_1_Name, Field_2_Name) Values (Field_1_Value, Field_2_Value)
Good Luck
HI v5prgrmr
•
•
•
•
I tried your QRY and now I get an error.
The error is ( Missing Semicolon at the end oof the SQL statement.
I have tried to place a Semicolon at the end and in diferent places in the SQL but I continue to get the same error.
This is my updated SQL statement.
Dim mysql As String = "insert into Customer_tbl values('First Name','Last Name') values ('John','Unknown');" •
•
Join Date: Mar 2009
Posts: 841
Reputation:
Solved Threads: 153
•
•
•
•
HI v5prgrmr
Dim mysql As String = "insert into Customer_tbl values('First Name','Last Name') values ('John','Unknown');"
Dim mysql As String = "insert into Customer_tbl ('First Name','Last Name') values ('John','Unknown');" Remove that first values
![]() |
Similar Threads
- Get data from Access instead of Notepad (URGENT) (C#)
- insert query in c# (ASP.NET)
- Access database error "Cannot open action query" (C#)
- INSERT data into access database isnt inserting data (VB.NET)
- insert data to Access (ASP)
- DataAdapter problem with MS-Access (C#)
- MS Access Error - sometimes (ColdFusion)
- a blank form to insert data???? (Visual Basic 4 / 5 / 6)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: i need help vb
- Next Thread: Convert Case To Random In Vb6
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age append application basic beginner birth bmp calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver subroutine table tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows






