连接SLQSever困惑我很久的问题
先看代码如下
Dim mmsConString As String = "Data Source=10.10.2.179;Initial Catalog=DBTEST;Persist Security Info=True;User ID=sa;Password=Chaos2;"
conn = New SqlConnection(mmsConString)
Try
conn.Open()
trans = conn.BeginTransaction()
cmd = New SqlCommand()
cmd.Connection = conn
For cnt As Integer = 1 To 1
Dim sbCmd As New StringBuilder
sbCmd.Append(" INSERT INTO jk_users(user_login,user_pass,user_nicename,user_email")
sbCmd.Append(" ,user_url,user_registered,user_activation_key,user_status,display_name) ")
sbCmd.Append(" VALUES (@user_login,@user_pass,@user_nicename,@user_email,@user_url, ")
sbCmd.Append(" @user_registered,@user_activation_key, @user_status,@display_name) ")
cmd.CommandText = sbCmd.ToString()
cmd.Parameters.Add(New SqlParameter("@user_login", 10))
cmd.Parameters.Add(New SqlParameter("@user_pass", "user_pass"))
cmd.Parameters.Add(New SqlParameter("@user_nicename", "user_nicename"))
cmd.Parameters.Add(New SqlParameter("@user_email", "user_email"))
cmd.Parameters.Add(New SqlParameter("@user_url", "user_url"))
cmd.Parameters.Add(New SqlParameter("@user_registered", Date.Now))