User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP section within the Web Development category of DaniWeb, a massive community of 391,961 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,988 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP advertiser: Lunarpages ASP Web Hosting

Make an asp with database (access)

Join Date: Sep 2007
Posts: 1,054
Reputation: SheSaidImaPregy is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 61
SheSaidImaPregy SheSaidImaPregy is offline Offline
Veteran Poster

Re: Make an asp with database (access)

  #2  
Feb 5th, 2008
You need to connect to your MS Access database, open a new recordset, then insert the information. It's an easy process, however, you should always do validation on what you're inserting, which is what makes it a bit more difficult and lengthy.

Find a connection string at : http://www.connectionstrings.com
Then your code should be something like this:
Dim strDbConnection
Dim objConn
Dim strSQL
strDbConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\test.mdb;"
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open(strDbConnection)
strSQL = "INSERT INTO persons (fullname, birthDate) VALUES ('" & Request.Form("fieldname") & "', '" & Request.Form("fieldname") & "')"
objConn.Execute(strSQL)
objConn.Close()
Set objConn = Nothing
Just keep in mind, interger fields (Int, Bigint, etc.) do not need single quotes.
Reply With Quote  
All times are GMT -4. The time now is 9:09 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC