connection string defined in a global.asa file
am 29.09.2006 11:11:25 von philea_92
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
Set ConnTemp=Nothing
Re: connection string defined in a global.asa file
am 29.09.2006 12:09:23 von Anthony Jones
wrote in message
news:%238OW%23c64GHA.1460@TK2MSFTNGP05.phx.gbl...
> Hi,
>
> I have a connection string defined in a global.asa file.. Am I
> referencing this correctly from this script?
>
First off use Option Explicit in the top of your ASP.
> 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
>
My guess is this:-
> 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
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.
> 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
and this:-
> ConnTemp.Close
> Set ConnTemp=Nothing
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.