-1

i have ms access database in that i have different tables. I want to enter values through windows form application in database . can anyone suggest me how to do coding for above requirement in VB.net . I am using Visual studio 2010 express edition.

5
  • Please show some effort before posting. There are millions of links on this. Do you have done some research before? Do you have some code that doesn't work as you expect? Or are just sitting there waiting for someone to write the code for you? Commented Dec 7, 2015 at 9:56
  • InsertQuery = "INSERT INTO Table1table (L1,L2,L3,L4,L5,) VALUES (@L1,@L2,@L3,@L4,@L5)" Commented Dec 7, 2015 at 10:17
  • I am getting "Syntax error in INSERT INTO statement" Commented Dec 7, 2015 at 10:17
  • Oh, well we are making some advances. Now if you just edit your question showing the REAL code with the REAL column names and values that leads to the Syntax error we could help to fix it Commented Dec 7, 2015 at 10:40
  • Possible duplicate of How would I insert data into an Access table using vb.net? Commented Dec 8, 2015 at 12:32

1 Answer 1

0

for your reference...

Dim con As New OleDb.OleDbConnection
Dim cmd As New OleDb.OleDbCommand
Dim rdr As OleDb.OleDbDataReader

con.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\DatabaseName.accdb;Persist Security Info=False;"
con.Open()

cmd = New OleDbCommand("INSERT INTO tableName (c1, c2) VALUES (@c1, @c2", con)
cmd.Parameters.AddWithValue("@c1", txtbox1.text)
cmd.Parameters.AddWithValue("@c2", txtbox2.text)
cmd.ExecuteNonQuery()
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.