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)

          有趣網絡

          搜索

          積分與排名

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 奉新县| 松潘县| 云南省| 肇州县| 台北县| 太仆寺旗| 安阳县| 治多县| 泸水县| 汉中市| 安顺市| 内黄县| 股票| 卓尼县| 通海县| 遂昌县| 曲麻莱县| 自治县| 大石桥市| 文登市| 讷河市| 来宾市| 巴彦县| 康定县| 祥云县| 陇南市| 鄂尔多斯市| 大理市| 娄烦县| 贵溪市| 凭祥市| 巧家县| 阿坝县| 陆川县| 紫阳县| 东莞市| 灵宝市| 大洼县| 平利县| 青州市| 安泽县|