當前位置:首頁 » 編程語言 » VS登陸注冊顯示頁面sql代碼
擴展閱讀
webinf下怎麼引入js 2023-08-31 21:54:13
堡壘機怎麼打開web 2023-08-31 21:54:11

VS登陸注冊顯示頁面sql代碼

發布時間: 2023-01-24 10:57:47

⑴ 怎麼用vs2010做一個asp登錄和注冊的網頁誰有具體步驟和相對應的代碼,連接sql資料庫的那種

登陸的button中 連接資料庫 conn.Open(); string str="select * from biao where name=+TextBox1.Text+ and password= +TextBox2.Text+"; sqlcommand comm=new sqlcommand(str,conn); sqldatareader dr=comm.executereader(); if(dr.read()) {response.write("");} else { 還是上邊那個改成 登陸失敗 }怎麼用vs2010做一個asp登錄和注冊的網頁?誰有具體步驟和相對應的代碼,連接sql資料庫的那種

⑵ vs 2005中怎麼做登錄和注冊的頁面

在ASP.NET中訪問SQL Server
在ASP.NET中訪問SQL Server資料庫有兩種方法,它們是System.Data.OleDb和System.Data.SqlClient。下面這段程序以System.Data.SqlClient為例訪問本地資料庫伺服器。

首先導入名字空間:System.Data和System.Data.SqlClient。詳細代碼看源程序。

<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<html>
<script language="C#" runat="server">
protected void Page_Load(Object Src, EventArgs E )
{
SqlConnection myConn = new SqlConnection("server=localhost;uid=sa;pwd=;database=pubs");
//創建對象SqlConnection
string strSQL="SELECT au_id,au_lname,au_fname,phone,address,city,zip FROM authors";
SqlDataAdapter myCmd = new SqlDataAdapter(strSQL, myConn);
//創建對象SqlDataAdapter
DataSet ds = new DataSet();
//創建對象DataSet
myCmd.Fill(ds);
//填充數據到Dataset
DataView source = new DataView(ds.Tables[0]);
MyDataGrid.DataSource = source ;
MyDataGrid.DataBind();
//將數據綁定到DataGrid
}
</script>
<body>
<h3><font face="Verdana">Simple SELECT to a DataGrid Control
</font></h3>
<ASP:DataGrid id="MyDataGrid" runat="server"
Width="600"
BackColor="#ccccff"
BorderColor="black"
ShowFooter="false"
CellPadding=3
CellSpacing="0"
Font-Name="Verdana"
Font-Size="8pt"
HeaderStyle-BackColor="#aaaadd"
MaintainState="false"
/>
</body>
</html>

⑶ 用s q l+vs做一個注冊登錄網站。c#

新建資料庫用戶表 user


int_id 編號自增

vc_name 姓名字元串

int_type 類型(1 學生,2教師,3管理員)

vc_loginName 登錄帳號

vc_Password登錄密碼



在表中預制管理員和教師數據(因為無需注冊,直接登錄)

int_idvc_nameint_typevc_loginName vc_PassWord

1管理員3admin 123

2 李老師 2zls 123



登錄頁面新建dropdownlist
<asp:DropDownListrunat="Server"id="drp_type">
<asp:ListItemValue="1"Text="學生"></asp:ListItem>
<asp:ListItemValue="2"Text="教師"></asp:ListItem>
<asp:ListItemValue="3"Text="管理員"></asp:ListItem>
</asp:DropDownList>
登錄帳號密碼輸入框
<inputrunat="server"id="tb_name">
<inputrunat="server"id="tb_pwd">


後台驗證



string selectedType=drp_type.SelectedValue;

string userName=tb_name.value;

string pwd=tb_pwd.value;


sql語句

stringsql="selectcount(*)fromuserwhereint_type="+selectedType+"andvc_username='"+userName+"'andvc_passWord='"+pwd+"'";

//執行sql語句如果結果大於0就是驗證成功可以登錄。

⑷ vs2008和SQL Server 2008 做的用戶登錄注冊界面 全部代碼

public static class HelperMess
{
private static string user;

public static string User
{
get { return HelperMess.user; }
set { HelperMess.user = value; }
}
}
登陸成功直接賦值
樓下:WinForm里絕對沒有Session概念,
由於WinForm的工作流程原理與WebForm截然不同,,
對WinForm來講完全沒必要引用Session這個概念
有空交流

⑸ vs2010 編寫登錄按鈕代碼

string sql = "select * from bs_appuser t where t.appuser_cd='" + TextBox1.Text.ToUpper().Trim() + "' and t.passwordhash_tx='"
+ FormsAuthentication.(TextBox2.Text, "MD5") + "'";
OracleConnection con = new OracleConnection(strConn);
con.Open();
OracleCommand cmd = new OracleCommand(sql,con);
OracleDataReader a = cmd.ExecuteReader();
if (a.Read())
{
string User_ID = a[0].ToString();
string User_Name = a[1].ToString();
string sql2 = "select * from bs_appuserrole t where t.appuser_id='"+ User_ID +"'";
OracleConnection con1 = new OracleConnection(strConn);
con1.Open();
OracleCommand cmd1 = new OracleCommand(sql2);
OracleDataReader a2 = cmd.ExecuteReader();
if (a2.Read())
{
Session["User_ID"] = a2[0];
}
con1.Close();
con1.Dispose();
Response.Redirect("manageWarehouse.aspx");
}
else
{
ScriptManager.RegisterStartupScript(this.UpdatePanel1, Page.GetType(), System.DateTime.Now.Ticks.ToString(), "alert('身份不對或密碼錯誤!');", true);
}
con.Close();
con.Dispose();

⑹ 用VS跟SQL2008一起弄的用戶注冊頁面SQL用的是Windows身份登陸VS代碼怎麼寫

題注可以參考petshop程序,這是微軟提供的.net示例,內容對初學者有很大的幫助
祝好運,望採納。

⑺ VS2005做網頁登陸界面鏈接資料庫,50分懸賞,滿意追加50

這是頁面的代碼。
資料庫鏈接的代碼不在這里,在它背後的.cs文件里,或者在vs里的資料庫資源管理器,然後在設計視圖里綁定到表上。

幫你找了一點資料,你仔細看一下就明白了。

⑻ 用VS創建一個連接SQL資料庫的登陸界面需要哪些步驟最好能把關鍵代碼寫出來 感謝

protected void btnQuery_Click(object sender, EventArgs e)
{
string str = "Data Source=.;Initial Catalog=lianxi;Integrated Security=True";
SqlConnection conn = new SqlConnection(str);
int count = 0;
try
{
conn.Open();
string sql = "select count (*) from UserForm where UserName=@username and UserPassWord=@userpassword";
SqlCommand cmd = new SqlCommand(sql, conn);
cmd.Parameters.Add(new SqlParameter("@username", this.tbUserName.Text));
cmd.Parameters.Add(new SqlParameter("@userpassword", this.tbUserPassWord.Text));

count = (int)cmd.ExecuteScalar();
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
finally
{
conn.Close();
}

if (count > 0)
{
Response.Write("<script>alert('登陸成功!')</script>");
}
else
{
Response.Write("<script>alert('登陸失敗!')</script>");
}

}

⑼ 用vs編寫基於C#的登陸注冊頁面

那句話的意思是根據sql語句查詢資料庫中滿足條件的數據,返回dataset對象;數據加密跟創建表沒多大的關系,1張用戶表就行,可以把加密後的數據存儲在用戶表中,驗證的時候要麼解密比較是否相等,要麼就加密後比較是否相等;相等就通過,不等就用戶或密碼錯誤