Hi, I'm new here and I have a little question about ASP.NET but before that maybe I can explain what my project is.
It is a graduation thesis project about an e-commerce website using ASP.NET and SQL server 200 database. At first I coded my project in ASP (before migrating to ASP.NET) I used to code the ASP in notepad++ and then run it on a web server. Now I used visual web developer express to write the ASP.NET code
Before, to access the access database (I used access before intending to use SQL server 200) I used this code
CODE
dim adoCon
dim pass
dim strSQL
dim nama_user
dim kode_user
dim logged_in
Set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("/Daggio/db/db1.mdb")
Set pass = Server.CreateObject("ADODB.Recordset")
pass.open "SELECT tblMemberInfo.MemberName, tblMemberInfo.Password FROM tblMemberInfo where MemberName = '"& nama_user &"'",adocon,1
so how do I do the same to connect to SQL server database using ASP.NET?
also, somehow the validation using javascript doesn't work (it worked when I used ASP) here's the javascript
CODE
function validate_required(field,alerttxt)
{
with (field)
{
if (value==null||value=="")
{alert(alerttxt);return false;}
else {return true}
}
}
function validate_security(field,alerttxt)
{
with (field)
{
if (value.match("<") && value.match(">") || value.match("'") || value.match("="))
{alert(alerttxt);return false;}
else {return true}
}
}
function validate_form(thisform)
{
with (thisform)
{
if (validate_required(username,"Username harus diisi!")==false)
{username.focus();return false;}
if (validate_required(password,"Password harus diisi!")==false)
{password.focus();return false;}
if (validate_security(username,"Dilarang menggunakan karakter non alphanumeric.")==false)
{username.focus();return false;}
if (validate_security(password,"DIlarang menggunakan karakter non alphanumeric.")==false)
{password.focus();return false;}
}
}
and here's how I implement it
CODE
<form action = "Login.aspx" method = "post" onsubmit = "return validate_form(this)">
<center>
<table border = "0" bgcolor = "cyan">
<tr>
<td colspan = "2" align = "center">Log in</td>
</tr>
<tr>
<td>Username:</td>
<td><input type = "text" name = "user" id = "username" onfocus = "setStyle(this.id)" onblur = "loseStyle(this.id)" /></td>
</tr>
<tr>
<td>Password:</td>
<td><input type = "password" name = "pass" id = "password" onfocus = "setStyle(this.id)" onblur = "loseStyle(this.id)" /></td>
</tr>
<tr>
<td colspan = "2"><input type = "hidden" name = "loggedin" value = "yes" /></td>
</tr>
<tr>
<td><input type = "submit" name = "submit" value = "Log in" /></td>
<td><a href = "register.asp">Belum daftar?daftar disini.</a></td>
</tr>
</table>
</center>
</form>
and I heard you can write ASP.NET code in notepad and then compile it in command prompt, is it true? if so how do I do it?
thanks, any help would be appreciated