[讨论]如何才能把注册的新用户写进数据库呢?
各位师兄:
最近我编写了一个注册界面,可我注册的用户不能进入数据库,怎么办呢?是不是要定义一个变量(session)啊。能不能教我如何写代码?
Dim sqlcomd As SqlComma Dim sqldataadapter1 As SqlDataAdapter Dim sqlconnection1 As SqlConnection sqlconnection1 = New SqlConnection sqlcomd = New SqlCommand sqldataadapter1 = New SqlDataAdapter Dim ds1 As DataSet ds1 = New DataSetsqlconnection1.ConnectionString = "data source=localhost;database=computertest;uid=sa;pwd=;" sqlcomd.CommandText = "insert into 表名 (字段名)" & "values('" & TextBox1.Text & "')" sqlcomd.Connection = sqlconnection1 sqldataadapter1.SelectCommand = sqlcomd sqlconnection1.Open() sqlcomd.ExecuteNonQuery() sqlconnection1.Close() lbwarring.Text = "注册成功"
好好理解理解,再灵活运用.