今天我们做了一个注册界面虽然做的不是很好吧,但是今天还是学的挺多的;给力的注册:
Asp与数据库连接
string s1 = this.Text1.Value;
string s2 = this.Text2.Value;
string s3 = this.Text3.Value;
string str = "insert into Tab(name,mail,birthday)VALUES('" + s1 + "','" + s2 + "','"+s3+"')";
SqlConnection con = new SqlConnection();
con.ConnectionString = "server=ZYB-PC\SQLEXPRESS;Integrated Security=true; Initial Catalog=ZC";
con.Open();
SqlCommand cmd = new SqlCommand(str, con);
//cmd.CommandType = CommandType.SturedProcedure;
cmd.Parameters.Add("@name", SqlDbType.NChar, 10).Value = Text1.Value;
cmd.Parameters.Add("@mail", SqlDbType.NVarChar, 20).Value = Text2.Value;
SqlDataReader myreader;
myreader = cmd.ExecuteReader();
Console.WriteLine("注册成功|");
con.Close();
本文发布于:2024-01-29 10:41:46,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/170649610714702.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |