PeOfEo
03-05-2003, 03:59 PM
Hey Ribeyed, you said on my registration page I still had a few synatx problems that could cause problems that I should change. Where exactly do you see them? I just got a report of a #500 error on the registration page, but these errors are rare now so I think I still have a few quirks. I realise that is not always my code that causes these but a server change and things like that can too, like if your pages are on different servers like on a web farm like my host =(. Anyways Ill pst my code below as a reference. P.S. That new log in script you helped me with works like a charm, Thanks a Bunch!
PeOfEo
03-05-2003, 03:59 PM
<%@ Page Language="VB" Debug="true" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OLEDB" %>
<script runat="server">
Sub SubmitBtn_Click(Sender As Object, E As EventArgs)
if txtrank.selecteditem.value = "Peasent" then
lblrnkval.text="1"
end if
if txtrank.selecteditem.value = "Soldier" then
lblrnkval.text="2"
end if
if txtrank.selecteditem.value = "Page" then
lblrnkval.text="3"
end if
if txtrank.selecteditem.value = "Guard" then
lblrnkval.text="4"
end if
if txtrank.selecteditem.value = "Knight" then
lblrnkval.text="5"
end if
if txtrank.selecteditem.value = "Elite" then
lblrnkval.text="6"
end if
if txtrank.selecteditem.value = "Lord" then
lblrnkval.text="7"
end if
if txtrank.selecteditem.value = "Preist" then
lblrnkval.text="8"
end if
if txtrank.selecteditem.value = "Paladin" then
lblrnkval.text="9"
end if
if txtrank.selecteditem.value = "Apprentice" then
lblrnkval.text="10"
end if
if txtrank.selecteditem.value = "Noble" then
lblrnkval.text="11"
end if
Dim CmdStr As String
Dim DBConn as OleDbConnection
Dim DBCommand As OleDbDataAdapter
Dim DSLogin as New DataSet
Dim DBInsert As New OleDbCommand
DBConn = New OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;" _
& "DATA SOURCE=" _
& Server.MapPath("/knightsempire/db/members/" _
& "members.mdb;"))
DBCommand = New OleDbDataAdapter _
("Select Count(MemberID) as TheCount " _
& "from Members Where " _
& "MemName = '" & txtMemberName.Text _
& "'", DBConn)
DBCommand.Fill(DSLogin, _
"TheCount")
If DSLogin.Tables("TheCount").Rows(0).Item("TheCount") = 0 Then
CmdStr = "Insert Into Members " _
& "(MemName, [Password],bots, rank, rankval, sc, d2, wc3, Email) " _
& "values (@memname, @password, @bots, @rank, @rankval, @sc, @d2, @wc3, @email)"
DBInsert = new OleDbCommand(CmdStr, DBconn)
DBInsert.Parameters.Add("@memname", OleDbType.VarChar, 255)
DBInsert.Parameters.Add("@password", OleDbType.VarChar, 255)
DBInsert.Parameters.Add("@bots", OleDbType.VarChar, 255)
DBInsert.Parameters.Add("@rank", OleDbType.VarChar, 255)
DBInsert.Parameters.Add("@rankval", OleDbType.VarChar, 255)
DBInsert.Parameters.Add("@sc", OleDbType.VarChar, 255)
DBInsert.Parameters.Add("@d2", OleDbType.VarChar, 255)
DBInsert.Parameters.Add("@wc3", OleDbType.VarChar, 255)
DBInsert.Parameters.Add("@email", OleDbType.VarChar, 255)
DBInsert.Parameters("@memname").Value = Replace(txtMemberName.text, "'", "''")
DBInsert.Parameters("@password").Value = Replace(txtPassword.text, "'", "''")
DBInsert.Parameters("@bots").Value = Replace(txtbots.text, "'", "''")
DBInsert.Parameters("@rank").Value = Replace(txtrank.selecteditem.value, "'", "''")
DBInsert.Parameters("@rankval").Value = Replace(lblrnkval.text, "'", "''")
DBInsert.Parameters("@sc").Value = Replace(ddlsc.selecteditem.value, "'", "''")
DBInsert.Parameters("@d2").Value = Replace(ddld2.selecteditem.value, "'", "''")
DBInsert.Parameters("@wc3").Value = Replace(ddlwc3.selecteditem.value, "'", "''")
DBInsert.Parameters("@email").Value = Replace(txtEmailAddress.text, "'", "''")
DBConn.Open()
DBInsert.ExecuteNonQuery()
DBCommand = New OleDbDataAdapter _
("Select MemberID from Members Where " _
& "MemberName = '" & txtMemberName.Text _
& "' and Password = '" & txtPassword.Text _
& "'", DBConn)
Response.Redirect("./list.aspx")
Else
lblMessage.Text = "The member name you entered is in " _
& "use by another member. Please enter " _
& "another member name."
End If
End Sub
</SCRIPT>
<HTML>
<HEAD>
<TITLE>Register</TITLE>
</HEAD>
<BODY BACKGROUND="http://www12.brinkster.com/knightsempire/tilehdark.jpg" TEXT="4682b4" LINK="00ffff" VLINK="00ffff" ALINK="00ffff" LEFTMARGIN="40">
<style>
body {
scrollbar-arrow-color:#003366;
scrollbar-track-color:#000000;
scrollbar-shadow-color:#003366;
scrollbar-face-color:#000000;
scrollbar-highlight-color:#003366;
scrollbar-darkshadow-color:#000000;
scrollbar-3dlight-color:#000000;
}
</style>
<form runat="server">
<asp:table runat="server" bgcolor="000000" align="center" cellpadding="10" style="border: 1px solid #003366">
<asp:tablerow runat="server">
<asp:tablecell runat="server">
<CENTER>
<asp:Label
id="lblTitle"
BorderWidth="0px"
BorderStyle=7
Width="90%"
Font-Size="15pt"
Font-Name="Ms Sans Serif"
Text="New Recruits"
runat="server"
/>
</CENTER>
<P></P>
<asp:Label
id="lblMessage"
Font-Size="12pt"
Font-Name="Tahoma"
runat="server"
Text="Complete each field to add your account to the data base."
/>
<P></P><Font Face="Tahoma">Member Name:</Font><BR>
<style type="text/css">
</style>
<asp:TextBox
id="txtMemberName"
Columns="25"
MaxLength="30"
runat="server"
/>
<asp:RequiredFieldValidator
id="rfvMemberName"
ControlToValidate="txtMemberName"
Display="Dynamic"
Font-Name="Tahoma"
Font-Size="10pt"
runat="server"
ErrorMessage="Member Name is Required!">
</asp:requiredfieldvalidator>
<P></P><Font Face="Tahoma">Password:</Font><BR>
<asp:TextBox
id="txtPassword"
Columns="25"
MaxLength="30"
runat="server"
TextMode="Password"
/>
<asp:RequiredFieldValidator
id="rfvPassword"
ControlToValidate="txtPassword"
Display="Dynamic"
Font-Name="Tahoma"
Font-Size="10pt"
runat="server"
errormessage="Password is Required!">
</asp:RequiredFieldValidator>
<P></P><Font Face="Tahoma">Repeat Password:</Font><BR>
<asp:TextBox
id="txtPassword2"
Columns="25"
MaxLength="30"
runat= "server"
TextMode="Password"
/>
<asp:RequiredFieldValidator
id="rfvPassword2"
ControlToValidate="txtPassword2"
Display="Dynamic"
Font-Name="Tahoma"
Font-Size="10pt"
runat="server"
errormessage="Password is required!">
</asp:RequiredFieldValidator>
<asp:CompareValidator
ControlToCompare="txtPassword"
ControlToValidate="txtPassword2"
Display="Dynamic"
ErrorMessage="Password 1 doesn't match password 2"
Font-Name="Tahoma"
Font-Size="10pt"
id="cvPassword"
Operator="Equal"
runat="server"
ValueToCompare="txtPassword" >
</asp:CompareValidator>
<P></P><Font Face="Tahoma">Your Rank:</Font><BR>
<asp:dropdownlist
id="txtrank"
runat="server">
<asp:ListItem value="Peasent">Peasent</asp:listitem>
<asp:ListItem value="Soldier">Soldier</asp:listitem>
<asp:ListItem value="Page">Page</asp:listitem>
<asp:ListItem value="Guard">Guard</asp:listitem>
<asp:ListItem value="Knight">Knight</asp:listitem>
<asp:ListItem value="Elite">Elite</asp:listitem>
<asp:ListItem value="Lord">Lord</asp:listitem>
<asp:ListItem value="Preist">Preist</asp:listitem>
<asp:ListItem value="Paladin">Paladin</asp:listitem>
<asp:ListItem value="Apprentice">Apprentice</asp:listitem>
<asp:ListItem value="Noble">Noble</asp:listitem>
</asp:dropdownlist>
<asp:Label
id="lblrnkval"
Font-Size="12pt"
Font-Name="Tahoma"
runat="server"
Text="1"
visible="false"
/>
<P></P><Font Face="Tahoma">Do you load bots, if so how many:</Font><BR>
<asp:TextBox
id="txtbots"
Columns="25"
MaxLength="30"
runat="server"
text="0"
/>
<P></P><Font Face="Tahoma">Email Address:</Font><BR>
<asp:TextBox
id="txtEmailAddress"
Columns="25"
MaxLength="30"
runat="server"
/>
<asp:RequiredFieldValidator
id="rfvEmailAddress"
ControlToValidate="txtEmailAddress"
Display="Dynamic"
Font-Name="Tahoma"
Font-Size="10pt"
runat="server"
ErrorMessage="Email is Required, If none put n/a!">
</asp:RequiredFieldValidator>
<BR><BR>
<P></P><Font Face="Tahoma">Do you play Diablo2/Diablo2 x?:</Font><BR>
<asp:dropdownlist
id="ddld2"
runat="server">
<asp:ListItem value="-">No</asp:listitem>
<asp:ListItem value="<li>">Yes</asp:listitem>
</asp:dropdownlist>
<P></P><Font Face="Tahoma">Do you play StarCraft/Brood War?:</Font><BR>
<asp:dropdownlist
id="ddlsc"
runat="server">
<asp:ListItem value="-">No</asp:listitem>
<asp:ListItem value="<li>">Yes</asp:listitem>
</asp:dropdownlist>
<P></P><Font Face="Tahoma">Do you play Warcraft3?:</Font><BR>
<asp:dropdownlist
id="ddlwc3"
runat="server">
<asp:ListItem value="-">No</asp:listitem>
<asp:ListItem value="<li>">Yes</asp:listitem>
</asp:dropdownlist>
<br><br>
<asp:button
id="butOK"
text=" OK "
Type="Submit"
OnClick="SubmitBtn_Click"
runat="server"
/>
<br><br>If you encounter any errors in this application please use this <a href="http://www12.brinkster.com/knightsempire/submit.html">Link</a>
</asp:tablecell>
</asp:tablerow>
</asp:table>
</form>
</BODY>
</html>
Ribeyed
03-06-2003, 04:46 PM
hi Nick,
here is an example of my web.config file:
<configuration>
<system.web>
<compilation defaultLanguage="vb" debug="true" />
<customErrors mode="RemoteOnly" />
<trace enabled="false"
requestLimit="10"
pageOutput="false"
traceMode="SortByTime"
localOnly="true" />
<sessionState mode="InProc"
cookieless="false"
timeout="20" />
<globalization requestEncoding="utf-8"
responseEncoding="utf-8" />
</system.web>
<appSettings>
<add key="appName" value="DBWeb" />
<add key="appAuthor" value="David Bell BA" />
</appSettings>
</configuration>
PeOfEo
03-06-2003, 05:18 PM
the error i get in the web.config is
<sessionState mode="InProc"
line 13
PeOfEo
03-06-2003, 05:31 PM
AHHHHHHHH MY HOST SUCKSSSS
General and General SE Solution .NET FAQs
Premium X4/X6/X8/X10 Solution Version
Microsoft .NET Technologies Supported
• .NET Framework v1 / ASP.NET v1
• .NET Mobile Internet Toolkit v1
Guidelines *A MUST READ*
1. In the General and General SE Solutions Code Behind is not supported.
2. All of your .NET code must be written in-line. This means that you must put all of your .NET code (VB.NET, C#, etc) in the .aspx file (or .asmx, .ascx, etc).
3. You will not have use of the global.asax file. (Premium X4-X10 Users can use this file.)
4. In your web.config file make sure you have the following settings:
<customErrors mode="Off" /> - This will show you your errors.
<authentication mode="Windows" /> - TAKE THIS OUT, the default needs to be used.
<sessionState /> - TAKE THIS OUT, the default needs to be used.
Frequently Asked Questions
Where is my BIN directory? How do I upload my assemblies (.DLLs)?
Due to Code Behind not being supported, we do not provide access to the BIN directory.
That is the guidlines. I changed my web.config to those standards, no custom errors. But now it seems to be working atleast. BUT I CAN'T DO ANYTHING COOL WITH THIS HOST. I had all my code together to make a live chatroom. No global. I want to do custom errors, no custom errormode. I have to find a better host, but moving is such a pain and plus I don't get any money from this, this is just practice. So I dont want to page 5 bucks monthly for hosting, even though free hosting utterly sucks
PeOfEo
03-06-2003, 05:33 PM
I am pretty sure that junk about written in means I cant use external src features like an external jscript or css. MY HOST SUCKS
Ribeyed
03-06-2003, 05:40 PM
hi Nick,
that does suck. I think you need to just build and test locally. Do this until you have enough money to find host that supports these features and until you have everything working.
PeOfEo
03-06-2003, 05:46 PM
Well a friend of mine and I wanted to make our own search engine this summer and we will make a minimum of 40 bucks a month in ads doing this. 10 for the account domain and other stuff and 15 each is how it will work. I am hoping in a about three months I will have a firm knowlege of asp.net. It only took me 2 to get very skilled in vb and 3 to learn html + some dhtml and java script. This is all solo learning so I hope I can do it as fast with asp.net
PeOfEo
03-06-2003, 05:48 PM
My register page might work now, atleast I can hope it will. If it does not ill play with it some more. How would I go about convirting it to an update stats page? Just change the sql statement from insert to update? That is the next thing I have on my agenda to learn how to do, update statements