944,117 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Marked Solved
  • Views: 4262
  • VB.NET RSS
Jul 6th, 2007
0

Understanding inserting data into an Access table using VB.NET

Expand Post »
I've been scouring the Net trying to get my head around using VB.NET to save information entered through text boxes on my form into an Access database. Most of what I see so far shows me how to display records already entered into the database and update the table, but I can't see how to add an empty database to my application. Can someone assist me by pointing me to or walking me through a step by step guide for capturing data entered via text boxes into a new database?
Similar Threads
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
bajanpoet is offline Offline
96 posts
since Sep 2006
Jul 7th, 2007
0

Re: Understanding inserting data into an Access table using VB.NET

Last edited by waynespangler; Jul 7th, 2007 at 12:01 pm.
Reputation Points: 84
Solved Threads: 58
Posting Pro in Training
waynespangler is offline Offline
461 posts
since Dec 2002
Jan 30th, 2011
0
Re: Understanding inserting data into an Access table using VB.NET


I want to add data to a table in a data base. this code have error in insert into statement. please solve this to me. thank you. [ujnimz]




Dim con As OleDbConnection
Dim com As OleDbCommand
Dim NAME As String
Try
con = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\NIMANTHA\Documents\DONUJ.accdb")
com = New OleDbCommand("INSERT INTO STUDENTS (StudentID, StudentName, Grade,TeacherIncharge)VALUES (@STID,@NAME,@GRADE,@TEACHER))", con)

con.Open()
MsgBox("DATABASE IS OPEN NOW")
com.Parameters.AddWithValue("@STID", TextBox1.Text)
com.Parameters.AddWithValue("@NAME", TextBox2.Text)
com.Parameters.AddWithValue("@GRADE", TextBox3.Text)
com.Parameters.AddWithValue("@TEACHER", TextBox4.Text)
com.ExecuteNonQuery()
NAME = TextBox2.Text
MsgBox("Add " & NAME & "'s status")
con.Close()
Catch ex As Exception
MsgBox(ErrorToString)
End Try
Reputation Points: 10
Solved Threads: 0
Newbie Poster
UJNimz is offline Offline
3 posts
since Jan 2011

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: Suggest Plz!
Next Thread in VB.NET Forum Timeline: Formatting Lost in Rich Text Box





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC