Dim txtFName As TextBox = CType(Wizard1.FindControl("txtFName"), TextBox)
Dim txtLName As TextBox = CType(Wizard1.FindControl("txtLName"), TextBox)
Dim MyDbConnection As New SqlConnection(ConfigurationManager.ConnectionStrings.Item("Journeyeast Connection String").ToString)
MyDbConnection.Open()
Dim SQL = "INSERT INTO Registration(FName, LName) VALUES (@FName, @LName)"
Dim MySqlCommand As New SqlCommand(SQL, MyDbConnection)
MySqlCommand.Parameters.Add("@FName", SqlDbType.NChar, 10, txtFName.Text)
MySqlCommand.Parameters.Add("@LName", SqlDbType.NChar, 10, txtLName.Text)
MySqlCommand.ExecuteNonQuery()
我收到以下错误:
参数化查询 '(@FName nchar(10),@LName nchar(10))INSERT INTO Registration(FNam' 需要未提供的参数 '@FName'。
我究竟做错了什么?
顺便说一句,我知道nchar(10)
名字和姓氏不是一个好的选择。