Archived

This topic is now archived and is closed to further replies.

eddiemjm

ASP & Databases

Recommended Posts

As a server, can I access databases on XP Professional using ASP on my web site??? The following code is erroneous... why??? sub RegisterInfo() <% Dim adoCon Dim rsAddnewmember Dim strSQL set adoCon=Server.CreateObject("ADODB.Connection") adoCon.Provider="Microsoft.Jet.OLEDB.4.0" adoCon.Open "C:\Inetpub\wwwroot\myweb\prototypefantasyfootballdb.mdb" Set rsAddnewmember = server.createobject("ADODB.Recordset") rsAddnewmember.Open "Select UserTable.LastName from UserTable", adoCon strSQL = "Insert into UserTable(LastName) Values (''" & request.form("LastName") & "'')" response.write(strSQL) adoCon.Execute(strSQL),recordsaffected adoCon.Close Set rsAddnewmember = Nothing Set adoCon = Nothing Response.Redirect "fantasyfootballREGISTERPAGE.asp" %> HELP!!!

Share this post


Link to post
Share on other sites
Yes. ADO is the common method.


Set DatabaseConnection = Server.CreateObject("ADODB.CONNECTION")
DatabaseConnection.Open "ADO connection string. Could directly reference a driver and database, or be an ODBC link"

Set DatabaseTable = DatabaseConnection.Execute("SELECT * FROM Users")
do while not DatabaseTable.EOF
Response.Write DatabaseTable.Fields("Name")
DatabaseTable.MoveNext
loop

Share this post


Link to post
Share on other sites