Loading...

          java .net

          2007年6月5日 星期二

          裝了個vs.net2005好些天了,今天做了個登錄頁面的練習,搗鼓了半天,又問人又查幫助的,呵呵,

          using System;
          using System.Data;
          using System.Data.SqlClient;
          using System.Configuration;
          using System.Web;
          using System.Web.Security;
          using System.Web.UI;
          using System.Web.UI.WebControls;
          using System.Web.UI.WebControls.WebParts;
          using System.Web.UI.HtmlControls;

          public partial class _Default : System.Web.UI.Page
          {
                   protected void Page_Load(object sender, EventArgs e)
                   {

                   }
                   protected void btnLogin_Click(object sender, EventArgs e)
                   {
                       string userName = this.tbUserName.Text;
                       string pwd = this.tbPwd.Text;
                       string sql = "select * from tb_user where id='" + userName + "' and passwd='" + pwd + "'";

                       String url = ConfigurationManager.ConnectionStrings["csConnectionString"].ConnectionString;


                       DataSet dataSet = new DataSet("user");
                       using (SqlConnection connection = new SqlConnection(url))
                       {
                           connection.Open();
                           SqlDataAdapter da = new SqlDataAdapter(sql, connection);
                           da.Fill(dataSet);
                           connection.Close();
                       }

                       if (dataSet.Tables[0].Rows.Count > 0)
                       {
                           Response.Write("<script>alert('login success');</script>");
                       }
                       else
                       {
                           Response.Write("<script>alert('login failed');</script>");
                       }

                   }
          }

          .net中數據適配器SqlDataAdapter 和數據集DataSet都不用關閉么?java中jdbc的Statement和ResultSet可都是要關的

          終于搗鼓出來了

          posted on 2008-08-26 22:06 閱讀(88) 評論(0)  編輯  收藏


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           

          公告

          希望有一天

          我能用鼠標雙擊我的錢包

          然后選中一張100元

          按住“ctrl+c”

          接著不停的“ctrl+v”

          嘻嘻~~~笑醒~~~



          導航

          <2008年8月>
          272829303112
          3456789
          10111213141516
          17181920212223
          24252627282930
          31123456

          統計

          常用鏈接

          留言簿(6)

          隨筆分類(102)

          隨筆檔案(398)

          文章分類

          文章檔案(10)

          有趣網絡

          搜索

          積分與排名

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 东乡| 竹山县| 泰州市| 亳州市| 措美县| 安岳县| 桂平市| 宁强县| 贵州省| 江口县| 沙洋县| 明溪县| 固安县| 昭觉县| 南丰县| 永年县| 桂阳县| 清苑县| 西和县| 谷城县| 天祝| 林西县| 佛山市| 育儿| 如皋市| 灵山县| 洛浦县| 鄂伦春自治旗| 铜梁县| 中江县| 铜川市| 花莲市| 千阳县| 陇川县| 靖西县| 进贤县| 紫云| 皮山县| 凤庆县| 化州市| 东乡|