求助!! .net 应用!~ 在线等

来源:百度知道 编辑:UC知道 时间:2024/06/15 10:15:36
用C# 做一个简单的web应用程序,就做一个简单的登录页面
能够和SQL SEVER 进行通信, 比如 判断用户名是否正确, 密码是否正确 , 模仿一些网站的登录界面, 给点提示, 一定要把代码写出来,
初学.net 有点迷糊 。。 还有就是我的一些按扭啊,与SQL数据库连接的代码是写那里啊? 是.aspx.cs 文件里吗?

谢谢 ,在线等

private void queding_Click(object sender, EventArgs e)
{
SqlConnection thisConnection = new SqlConnection(@"server=localhost;Trusted_Connection=yes;database=Library;");//连接本地的数据库
DataRow myRow;
thisConnection.Open();//打开数据库文件

SqlDataAdapter thisAdapter = new SqlDataAdapter("select AdminId,Password from TBL_AdminInfo", thisConnection);//查询数据段Id 和用户password并保存数据

DataSet thisDataSet = new DataSet();//数据集
thisAdapter.Fill(thisDataSet, "TBL_AdminInfo");

if (textid.Text.Trim() != "")
{
if (textmima.Text.Trim() != "")
{
for (int i = 0; i < thisDataSet.Tables["TBL_AdminInfo"].Rows.Count; i++)
{
myRow = thisDataSet.Tables["TBL_AdminInfo"