ASP链接SQL的简单登陆界面 - .NET技术 / ASP.NET
protected void btnLogin_Click(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection("Server = (local);user id = sa;pwd = 1;database = Login");
try
{
conn.Open();
string cmdText = "select username from userinfo where username = '" + this.txtUsername.Text.Trim() + "' and userpassword='" + this.txtPassword.Text.Trim() + "'";
SqlDataAdapter sqlCommon = new SqlDataAdapter(cmdText, conn);
DataSet ds = new DataSet();
sqlCommon.Fill(ds);
if (txtUsername.Text.Trim() == ds.Tables[0].Rows[0][" username"] && txtPassword.Text.Trim() == ds.Tables[0].Rows[0]["userpassword"])
{
conn.Close();
Response.Redirect("Default2.aspx");
}
else
{
lblResults.Visible = true;
lblResults.Text = "用户名或密码错误!";
txtUsername.Text = "";
txtPassword.Text = "";
}
conn.Close();
相关问答:
Imports System.ComponentModel
Imports System.Web.UI
Imports System.Web.UI.Design
Imports System.Web.UI.WebControls
Namespace CBDAspNet.WebControls.HTML
''' <summary>
'' ......
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jas ......
function CheckOpwd(){//验证用户名
var pwd=document.all.txtOpwd;
var div1=document.getElementById("divPwd");
if (pwd.value=="")
{
......
在asp里怎么调用java写的webservice方法,有很多方法
- <message name="RtPnrIn">
<part name="bstrPnrNO" type="s:string" />
<part name ......
asp虚拟主机实现伪静态的方法:
1、 重写url参数
Step1: 建立前台文件index.asp,修改url参数形式。由于读取数据库中的记录不是专题的重点,故直接给出:
<!--#include file="config.asp" -->
&l ......