# Database set up question

**URL:** <https://forum.kirupa.com/t/database-set-up-question/160581>\
**Category:** Uncategorized\
**Created:** [August 27, 2005, 5:39am UTC](https://forum.kirupa.com/t/database-set-up-question/160581 "2005-08-27T05:39:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tanker300](https://avatars.discourse-cdn.com/v4/letter/t/35a633/32.png) [@tanker300](https://forum.kirupa.com/u/tanker300)\
**Post date:** [August 27, 2005, 5:39am UTC](https://forum.kirupa.com/t/database-set-up-question/160581/1 "2005-08-27T05:39:49Z")

</div>

Hi,  
I can set up my database for asp without any problems but I need some help on 2 asp files. I do not know what to name my database or tables,fields. Can someone please help me. My site that it is on-http:www.tsigold.com

```
                      "Login.asp"

```

\<%@LANGUAGE=“VBSCRIPT”%\> \<%  
Dim myconnection\_\_strUserID  
myconnection\_\_strUserID = “x”  
if(Request.Form(“UserID”) \<\> “”) then myconnection\_\_strUserID = Request.Form(“UserID”)  
Dim myconnection\_\_strPassword  
myconnection\_\_strPassword = “1”  
if(Request.Form(“Password”) \<\> “”) then myconnection\_\_strPassword = Request.Form(“Password”)  
%\> \<%  
set myconnection = Server.CreateObject(“ADODB.Recordset”)  
myconnection.ActiveConnection =“dsn=k\_FlashLogin;”  
myconnection.Source = “SELECT \* FROM Login WHERE UserID = '” + Replace(myconnection\_\_strUserID, “’”, “’’”) + “’ AND Password = '” + Replace(myconnection\_\_strPassword, “’”, “’’”) + “’”  
myconnection.CursorType = 0  
myconnection.CursorLocation = 2  
myconnection.LockType = 3  
myconnection.Open  
myconnection\_numRows = 0  
%\>  
\<% If myconnection\_\_strUserID \<\> “x” Then  
If Not myconnection.EOF Then  
Response.Write “login=Granted”  
else  
Response.Write “login=Denied”  
End If  
End If  
%\>

```
                              "reg.asp"

```

\<%  
UserID = Request.Form(“UserID”)  
Password = Request.Form(“Password”)  
FirstName = Request.Form(“FirstName”)  
LasName = Request.Form(“LastName”)  
Email = Request.Form(“Email”)  
AccessGroup = Request.Form(“AccessGroup”)  
%\>  
\<html\>  
\<head\>  
\<title\>New Page 1\</title\>  
\<meta name=“GENERATOR” content=“Microsoft FrontPage 3.0”\>  
\</head\>  
\<body\>  
\<table width=“100%” border=“1”\>  
\<tr\>  
\<td\>\<b\>UserID\</b\>\</td\>  
\<td\>\<b\>Password\</b\>\</td\>  
\<td\>\<b\>FirstName\</b\>\</td\>  
\<td\>\<b\>LastName\</b\>\</td\>  
\<td\>\<b\>Email\</b\>\</td\>  
\<td\>\<b\>AccessGroup\</b\>\</td\>  
\</tr\>  
\<!–webbot bot=“DatabaseRegionStart” startspan  
s-columnnames=“UserID,Password,FirstName,LastName,Email,AccessGroup”  
s-connstring=“DSN=k\_FlashLogin” s-password b-tableformat=“TRUE”  
s-sql=“Insert Into Login (UserID, Password, FirstName, LastName, Email, AccessGroup) values (’%%UserID%%’,’%%Password%%’,’%%FirstName%%’, ‘%%LastName%%’, ‘%%Email%%’, ‘%%AccessGroup%%’)”  
local\_preview="\<tr\>\<td colspan=12 bgcolor="#FFFF00" align=“center” width=“100%”\>\<font color="#000000"\> Database Regions do not preview unless this page is fetched from a Web server using a web browser. The following table will display one row for each query result row when the page is fetched from a Web server.\</td\>\</tr\>"  
preview clientside s-DefaultFields  
s-NoRecordsFound=“Your registration has been successful.” i-MaxRecords i-ScriptTimeout  
tag=“BODY” --\>\<%  
’ Substitute in form parameters into the query string  
fp\_sQry = “Insert Into Login (UserID, Password, FirstName, LastName, Email, AccessGroup) values (’%%UserID%%’,’%%Password%%’,’%%FirstName%%’, ‘%%LastName%%’, ‘%%Email%%’, ‘%%AccessGroup%%’)”  
fp\_sDefault = “”  
fp\_sNoRecords = “Your registration has been successful.”  
fp\_iMaxRecords = 0  
fp\_iTimeout = 0  
fp\_iCurrent = 1  
fp\_fError = False  
fp\_bBlankField = False  
If fp\_iTimeout \<\> 0 Then Server.ScriptTimeout = fp\_iTimeout  
Do While (Not fp\_fError) And (InStr(fp\_iCurrent, fp\_sQry, “%%”) \<\> 0)  
’ found a opening quote, find the close quote  
fp\_iStart = InStr(fp\_iCurrent, fp\_sQry, “%%”)  
fp\_iEnd = InStr(fp\_iStart + 2, fp\_sQry, “%%”)  
If fp\_iEnd = 0 Then  
fp\_fError = True  
Response.Write “\<B\>Database Region Error: mismatched parameter delimiters\</B\>”  
Else  
fp\_sField = Mid(fp\_sQry, fp\_iStart + 2, fp\_iEnd - fp\_iStart - 2)  
If Mid(fp\_sField,1,1) = “%” Then  
fp\_sWildcard = “%”  
fp\_sField = Mid(fp\_sField, 2)  
Else  
fp\_sWildCard = “”  
End If  
fp\_sValue = Request.Form(fp\_sField)  
’ if the named form field doesn’t exist, make a note of it  
If (len(fp\_sValue) = 0) Then  
fp\_iCurrentField = 1  
fp\_bFoundField = False  
Do While (InStr(fp\_iCurrentField, fp\_sDefault, fp\_sField) \<\> 0) \_  
And Not fp\_bFoundField  
fp\_iCurrentField = InStr(fp\_iCurrentField, fp\_sDefault, fp\_sField)  
fp\_iStartField = InStr(fp\_iCurrentField, fp\_sDefault, “=”)  
If fp\_iStartField = fp\_iCurrentField + len(fp\_sField) Then  
fp\_iEndField = InStr(fp\_iCurrentField, fp\_sDefault, “&”)  
If (fp\_iEndField = 0) Then fp\_iEndField = len(fp\_sDefault) + 1  
fp\_sValue = Mid(fp\_sDefault, fp\_iStartField+1, fp\_iEndField-1)  
fp\_bFoundField = True  
Else  
fp\_iCurrentField = fp\_iCurrentField + len(fp\_sField) - 1  
End If  
Loop  
End If  
’ this next finds the named form field value, and substitutes in  
’ doubled single-quotes for all single quotes in the literal value  
’ so that SQL doesn’t get confused by seeing unpaired single-quotes  
If (Mid(fp\_sQry, fp\_iStart - 1, 1) = “”"") Then  
fp\_sValue = Replace(fp\_sValue, “”"", “”"""")  
ElseIf (Mid(fp\_sQry, fp\_iStart - 1, 1) = “’”) Then  
fp\_sValue = Replace(fp\_sValue, “’”, “’’”)  
ElseIf Not IsNumeric(fp\_sValue) Then  
fp\_sValue = “”  
End If  
If (len(fp\_sValue) = 0) Then fp\_bBlankField = True  
fp\_sQry = Left(fp\_sQry, fp\_iStart - 1) + fp\_sWildCard + fp\_sValue + \_  
Right(fp\_sQry, Len(fp\_sQry) - fp\_iEnd - 1)

’ Fixup the new current position to be after the substituted value  
fp\_iCurrent = fp\_iStart + Len(fp\_sValue) + Len(fp\_sWildCard)  
End If  
Loop  
If Not fp\_fError Then  
’ Use the connection string directly as entered from the wizard  
On Error Resume Next  
set fp\_rs = CreateObject(“ADODB.Recordset”)  
If fp\_iMaxRecords \<\> 0 Then fp\_rs.MaxRecords = fp\_iMaxRecords  
fp\_rs.Open fp\_sQry, “DSN=k\_FlashLogin”  
If Err.Description \<\> “” Then  
Response.Write “\<B\>Database Error: " + Err.Description + “\</B\>”  
if fp\_bBlankField Then  
Response.Write " One or more form fields were empty.”  
End If  
Else  
’ Check for the no-record case  
If fp\_rs.EOF And fp\_rs.BOF Then  
Response.Write fp\_sNoRecords  
Else  
’ Start a while loop to fetch each record in the result set  
Do Until fp\_rs.EOF  
%\>  
\<!–webbot bot=“DatabaseRegionStart” i-checksum=“43234” endspan --\>  
\<tr\>  
\<td\>\<!–webbot bot=“DatabaseResultColumn” startspan  
s-columnnames=“UserID,Password,FirstName,LastName,Email,AccessGroup” s-column=“UserID”  
b-tableformat=“TRUE” clientside local\_preview=“Database: UserID”  
preview=“Database: UserID” --\>\<%  
If Not IsEmpty(fp\_rs) And Not (fp\_rs Is Nothing) Then Response.Write CStr(fp\_rs(“UserID”))  
%\>  
\<!–webbot bot=“DatabaseResultColumn” i-checksum=“24692”  
endspan --\> \</td\>  
\<td\>\<!–webbot bot=“DatabaseResultColumn” startspan  
s-columnnames=“UserID,Password,FirstName,LastName,Email,AccessGroup” s-column=“Password”  
b-tableformat=“TRUE” clientside local\_preview=“Database: Password”  
preview=“Database: Password” --\>\<%  
If Not IsEmpty(fp\_rs) And Not (fp\_rs Is Nothing) Then Response.Write CStr(fp\_rs(“Password”))  
%\>  
\<!–webbot bot=“DatabaseResultColumn” i-checksum=“29488”  
endspan --\> \</td\>  
\<td\>\<!–webbot bot=“DatabaseResultColumn” startspan  
s-columnnames=“UserID,Password,FirstName,LastName,Email,AccessGroup” s-column=“FirstName”  
b-tableformat=“TRUE” clientside local\_preview=“Database: FirstName”  
preview=“Database: FirstName” --\>\<%  
If Not IsEmpty(fp\_rs) And Not (fp\_rs Is Nothing) Then Response.Write CStr(fp\_rs(“FirstName”))  
%\>  
\<!–webbot bot=“DatabaseResultColumn”  
i-checksum=“32411” endspan --\> \</td\>  
\<td\>\<!–webbot bot=“DatabaseResultColumn” startspan  
s-columnnames=“UserID,Password,FirstName,LastName,Email,AccessGroup” s-column=“LastName”  
b-tableformat=“TRUE” clientside local\_preview=“Database: LastName”  
preview=“Database: LastName” --\>\<%  
If Not IsEmpty(fp\_rs) And Not (fp\_rs Is Nothing) Then Response.Write CStr(fp\_rs(“LastName”))  
%\>  
\<!–webbot bot=“DatabaseResultColumn” i-checksum=“29199”  
endspan --\> \</td\>  
\<td\>\<!–webbot bot=“DatabaseResultColumn” startspan  
s-columnnames=“UserID,Password,FirstName,LastName,Email,AccessGroup” s-column=“Email”  
b-tableformat=“TRUE” clientside local\_preview=“Database: Email” preview=“Database: Email” --\>\<%  
If Not IsEmpty(fp\_rs) And Not (fp\_rs Is Nothing) Then Response.Write CStr(fp\_rs(“Email”))  
%\>  
\<!–webbot  
bot=“DatabaseResultColumn” i-checksum=“23454” endspan --\> \</td\>  
\<td\>\<!–webbot bot=“DatabaseResultColumn” startspan  
s-columnnames=“UserID,Password,FirstName,LastName,Email,AccessGroup”  
s-column=“AccessGroup” b-tableformat=“TRUE” clientside  
local\_preview=“Database: AccessGroup” preview=“Database: AccessGroup” --\>\<%  
If Not IsEmpty(fp\_rs) And Not (fp\_rs Is Nothing) Then Response.Write CStr(fp\_rs(“AccessGroup”))  
%\>  
\<!–webbot  
bot=“DatabaseResultColumn” i-checksum=“52422” endspan --\> \</td\>  
\</tr\>  
\<!–webbot bot=“DatabaseRegionEnd” startspan b-tableformat=“TRUE” local\_preview preview  
clientside tag=“BODY” --\>\<%  
’ Close the loop iterating records  
fp\_rs.MoveNext  
Loop  
End If  
fp\_rs.Close  
’ Close the If condition checking for a connection error  
End If  
’ Close the If condition checking for a parse error when replacing form field params  
End If  
set fp\_rs = Nothing  
%\>  
\<!–webbot bot=“DatabaseRegionEnd” i-checksum=“55813” endspan  
–\>  
\</table\>  
\</body\>  
\</html\>
