C怎麼將TextBox中輸入的資料與資料庫中資料相比較就是登陸怎麼弄

2021-05-10 21:08:25 字數 2234 閱讀 5964

1樓:匿名使用者

sqlconnection():抄連線資料庫然後襲用sql***mand()來執行baisql命令語句,也可以du是再sql裡面寫好儲存zhi過程。

最後dao呼叫對應表中的欄位資料,新建一個類,裡面新增有引數的方法,將textbox獲取的值

傳到方法的引數裡面就可以了。對於詳細還要你自己在網上找找資料,希望對你有所幫助。

2樓:匿名使用者

你首先寫一bai個方法把du

登入名和登入的密碼得到,這zhi個方法有dao2個引數登入名,密回

碼,你在新答建一個登入的介面 ,有2個textbox和一個botton按鈕,這個botton按鈕的單擊時間;具體事件**如下:

user user=new user();

user.username=this.textbox1.text.trim();

user.userpass=this.textbox2.text.trim();

usermamager.getusernameoruserpass(this.textbox1.

text.trim(),this.textbox1.

trim(),username,userpass)

if(usermanager.getusernameoruserpass(username,userpass)>0)

else

3樓:匿名使用者

先查詢資料庫中的欄位的資料

在進行判斷。

4樓:璀璨雪舞

前段時間寫了個,給我郵箱我發給你。 各種版本

c# 做登入介面在textbox輸入使用者名稱密碼,如何與資料庫裡資料進行對比驗證還要拿到姓名

5樓:陽光的雷咩咩

驗證:select count(*) from t where id= ***, pwd =yyy, 這裡你自己拼接sql,然後如果 (int)cmd.exeutescalar()返回值》0則驗證成功

姓名:select top 1 name from t where id = ***, cmd.exeutescalar().tostring()就是

6樓:我在長江尾

應該是 executescalar()

怎樣在c#在textbox中輸入資料自動存入資料庫

7樓:楷銥浴鍶

1、先把textbox.text.tostring()寫到你定義的變數。

string txtstr = textbox.text;

2、建立連線

sqlconnection con = new sqlconnection("server=.;database=hostel;uid=你資料庫管理員名;pwd=密碼";

3、開啟資料庫

con.open()

4、對資料庫進行操作(這幾步基本上的書都應該有吧)

sql***mand cmd = new sql***mand(insert into manage values(txtstr),con);

cmd.excutenonquery();

cmd.***mandtype = ***mandtype.text;

con.close();

夠清楚了吧 手寫的可能會有些毛病 但大概意思就是這樣

如何判斷c#textbox輸入的內容是否和sql資料庫裡面的內容一樣啊。。急急急急啊 詳細**

8樓:匿名使用者

思路就是先和資料庫做對比,然後通過結果來判斷**如下

string sql = "select userid,username from account_user_t where userid='" + txtemp.text + "' and password='" + txtpass.text + "' and flag='y' ";

ds = mysqlhelper.executedataset(dbconstr, sql);

if (ds.tables[0].rows.count > 0)//在資料庫裡找到結果輸入的是正確的資訊

else//在資料庫裡找到沒有結果

9樓:匿名使用者

... 你這問題 ,問得有點不明確。判斷是通過什麼事件來判斷? 是你在你輸入過程中 就判斷。還是在你輸入 完了以後。

C中怎麼獲取textbox的中輸入的值

如果你的 textbox 不是使用伺服器控制元件或沒有runat server 那麼提交表單請使用專 request textboxname 跟asp裡差不多,只不過屬asp裡是用 而不是。反之,請使用一樓的方法 string strtxt textboxid.text.tostring 希望能幫到...

C中textbox控制元件中輸入的數字如何賦值給Int型變數

在textbox裡面輸入的數字賦值給int temp 如何賦值 temp txtconverttoint textbox.text public static int txtconverttoint string txt temp txtconverttoint textbox.text publi...

C中的textBox1 Text Trim的Trim 表示什麼意思

去掉前後的空格 比如你不是定格寫起 去掉空格後 就取了 你寫的那部分 不包括空格 從當前 string 物件移除所有前導空白字元和尾部空白字元。就是去除字串兩邊的空格!c 中textbox1.text.trim 和textbox1.text.trim null有什麼區別?首先你這個語句就 是有問題的...