We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,294 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Visual Studio 2010 + Web Form + Insert + Access Database

I cannot believe how loooooong i have been searching the internet for this. However i have a form that i have created in Visual studio 2010.

I have 3 text boxes for FIRST NAME, LAST NAME and NOTES. I have 1 button to submit data.

When i click the button to submit the data, i would like for the data to insert into the database.

I can deal with validation, viewing the data and making it fancy later. For now, i just need the code behind the button to insert it into an Access 2010 database.

Please any help for a newbie.

Thank you in advance

System Jay

2
Contributors
1
Reply
2 Days
Discussion Span
1 Year Ago
Last Updated
3
Views
System Jay
Newbie Poster
7 posts since Apr 2008
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

The actual syntax of the SQL query is
INSERT INTO table (col1name,col2name,...) VALUES(val1,val2,...)

An actual example would be

insert into mytable (first_name,last_name,notes) values("john","smith","heck of a nice guy");

with table named "mytable". An example in VB would be

firstname = "John"
lastname = "Smith"
notes = "a heck of a nice guy"
table = "mytable"

query = "insert into " & table & " (first_name,last_name,notes) values(""" & firstname & """,""" & lastname & """,""" & notes & """)"

if your connection object is named "con" then execute the query by

con.Execute(query)

I find that the hardest part is keeping all the extra double quotes straight.

Reverend Jim
Carpe per diem
Moderator
3,605 posts since Aug 2010
Reputation Points: 561
Solved Threads: 449
Skill Endorsements: 32

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0753 seconds using 2.64MB