第一個項目BBS(1)

來源:互聯網
上載者:User

第一個頁面

註冊頁面 Reg.aspx 

頁面有2個文字框,一個Button,至於驗正碼和上傳圖片(圖片採用儲存位元據流)

,在另外一篇裡面寫吧

1,預存程序

Alter Procedure dbo.AddUser

(   

   @UserName varchar(50),

   @PassWord varchar(50)

)

As

insert into UserName(UserName,Password) values(@UserName,@Password)

2,封裝方法

定義一個全域變數:string sqlconn="server=localhost;uid=sa;pwd=;database=BBS";

public class ConDB

{

      

}

3,調用方法(Button單擊事中)

ConDB cdb=new ConDB();

int i=cdb.AddUser(TextBox1.Text,TextBox2.Text);

if(i==1)

{

      response.write("恭喜你註冊成功");

}

第一個簡單的頁面完成,其實裡面漏洞百出

後面我會加以改進,今天就到這裡吧

 

public int AddUser(string username,string password)

{

      SqlConnection conn=new SqlConnection(sqlconn);

      SqlCommand comm=new SqlCommand("AddUser",conn);

      comm.CommanType=CommandType.StoreProcedure;

      comm.Parameters.Add("@UserName",username);

      comm.Parameters.Add("Password",password);

      int i=comm.ExcuteNonQuery();

      return i;

     

}

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.