資源簡介
c#連接oracle實現用戶登錄以及密碼的修改,在寫入數據庫

代碼片段和文件信息
using?System;
using?System.Configuration;
using?System.Data;
using?System.Linq;
using?System.Web;
using?System.Web.Security;
using?System.Web.UI;
using?System.Web.UI.HtmlControls;
using?System.Web.UI.WebControls;
using?System.Web.UI.WebControls.WebParts;
using?System.Web.Configuration;
using?System.xml.Linq;
using?System.Data.OracleClient;
public?partial?class?_Default?:?System.Web.UI.Page?
{
????protected?void?Page_Load(object?sender?EventArgs?e)
????{
???????
????}
????protected?void?Button1_Click(object?sender?EventArgs?e)
????{
????????string?sql;
????????string?userName?=?TextBox1.Text;???????
????????string?password?=?TextBox2.Text;
????????Session[“name“]?=?TextBox1.Text;
????????Session[“pwd“]?=?TextBox2.Text;
????????string?conn=?“Data?Source=orcl;user=scott;password=tiger;“;
????????OracleConnection?connection?=?new?OracleConnection(conn);
????????sql?=?“select?count(*)??from?scott.password?where?name=‘“?+?userName?+?“‘?and?pwd=‘“?+?password?+?“‘“;
????????try
????????{
????????????connection.Open();
????????????OracleCommand?command?=?new?OracleCommand(sql?connection);
????????????Int32?num?=?Convert.ToInt32(command.ExecuteScalar());
????????????if?(num?>?0)
????????????{
????????????????Response.Redirect(“Default2.aspx“);
????????????}
????????????else
????????????{
????????????????Label5.Text?=?“用戶名或密碼錯誤,請重新輸入!“;
????????????}
????????}
????????catch?(Exception?ex)
????????{
????????????Label5.Text?=?“數據庫連接錯誤!“;
????????}
????????finally
????????{
????????????connection.Close();
????????}
????}
????
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2011-10-20?14:28??resetpwd\
?????目錄???????????0??2011-10-19?19:57??resetpwd\App_Data\
?????文件????????5265??2011-10-19?20:26??resetpwd\Default.aspx
?????文件????????1650??2011-10-20?14:28??resetpwd\Default.aspx.cs
?????文件?????????644??2011-10-19?20:26??resetpwd\Default2.aspx
?????文件?????????578??2011-10-19?19:57??resetpwd\Default2.aspx.cs
?????文件????????4808??2011-10-19?20:34??resetpwd\Default3.aspx
?????文件????????1759??2011-10-19?21:38??resetpwd\Default3.aspx.cs
?????文件????????8230??2011-10-19?20:23??resetpwd\web.config
- 上一篇:SharpTcpScanner掃描器1.9版
- 下一篇:C#實現在控件上畫直線
評論
共有 條評論