Groups | Blog | Home
all groups > inetserver asp db > september 2006 >

inetserver asp db : connection string defined in a global.asa file



Anthony Jones
9/29/2006 12:00:00 AM

[quoted text, click to view]

First off use Option Explicit in the top of your ASP.

[quoted text, click to view]

My guess is this:-

[quoted text, click to view]

Should be this:-

Set adoCon =Server.CreateObject("ADODB.Connection")
adoCon .Open Application("bureaudb")
Set rs = server.createobject("adodb.recordset")
rs.open "SELECT * from user_request_data where 1=0", adoCon , 3, 3

Note: if you are only doing an insert you don't want to fill the recordset
with existing records.

[quoted text, click to view]

and this:-

[quoted text, click to view]

should be:-

adoCon .Close
Set adoCon = Nothing


That said I prefer to execute an INSERT command rather than use a ado
recordset to peform an update.

Anthony.

philea_92 NO[at]SPAM msn.com
9/29/2006 2:11:25 AM
Hi,

I have a connection string defined in a global.asa file.. Am I
referencing this correctly from this script?

the connection string is defined as application("bureaudb")


<%
Dim strFullname, strUsername, strPassword, strImportdirectory,
strExportdirectory, strVerifypword
Dim adoCon
Dim rsAddComments
Dim strSQL
Dim strUser

strFullname = Request.Form("fullname")
strUsername = Request.Form("username")
strPassword = Request.Form("pword")
strVerifypword = Request.Form("verifypword")

IF strFullname <> "" AND strUsername <> "" AND strPassword <>"" AND
strPassword = strVerifypword THEN

Set StrConn=Server.CreateObject("ADODB.Connection")
StrConn.Open Application("bureaudb")
Set rs = server.createobject("adodb.recordset")
rs.open "SELECT * from user_request_data", ConnTemp, 3, 3
strUser = request.ServerVariables ("REMOTE_ADDR")
rs.addNew
rs.fields("fullname") = Request.Form("fullname")
rs.fields("client") = Request.Form("clientname")
rs.fields("username") = Request.Form("username")
rs.fields("password") = Request.Form("pword")
rs.fields("importdirectory") = "h:\" & Request.Form("username")
rs.fields("exportdirectory") = "h:\" & Request.Form("username")
rs.fields("ApplicationClusterID") = Request.Form("AppClusterID")
rs.fields("AppID") = Request.form("AppID")
rs.fields("last_updated_time") = now()
rs.fields("date_requested") = now()
rs.fields("Group_ID") = Request.Form("GroupID")
rs.fields("last_updated_by") = strUser
rs.Fields("CountryID") = Request.Form("CountryID")
rs.Fields("RequestorID") = Request.Form ("RequestorID")
rs.update
rs.close
set rs = nothing
ConnTemp.Close
AddThis Social Bookmark Button