开头这句好像有问题
Dim Check_ID As String = Members.CheckID(userID.Text)
IF Check_ID="1" Then
Check_ID是 string 类型的
Check_ID="1" 表示的是赋值啊
不是等于
应该是==吧

解决方案 »

  1.   

    没有用过vb,反正在c#里面应该是==
      

  2.   

    我试过了,用==也是不对的。
    标准表达式中数据类型不匹配。
        好像就是这句不对,但我不知道错在哪里,而且我试过把dim customer_id去掉,同样不对!敬请之教!
    Dim Customer_Id As String = Members.AddMember(Name.Text,userID.Text,Password.Text,Sex.SelectedItem.Text,Birthday.Text,Tel.Text,Address.Text,Email.Text)
    Message2.InnerHtml = "添加成功"
    SaveBtn.visible= False
     
      

  3.   

    IF Check_ID="1" Then 这是没有问题的自己调试一下找到出错行吧!别猜啦!
      

  4.   

    出错行就是这一行:Dim Customer_Id As String = Members.AddMember(Name.Text,userID.Text,Password.Text,Sex.SelectedItem.Text,Birthday.Text,Tel.Text,Address.Text,Email.Text)
    但我不知错在哪里?
      

  5.   

    Sex.SelectedItem.Text
    试一下改为Sex.SelectedItem.Value将Members.AddMenber这个函数的定义贴出来看看!
      

  6.   

    Public Function AddMember(fullName As String,userID As String,password As String,sex As String, Birthday As String,Tel As String,Address As String,Email As String) As String
                Dim myConnection As OleDbConnection = new OleDbConnection(ConfigurationSettings.AppSettings("DSN"))
                Dim BeginCode As integer
        Randomize 
                BeginCode=CInt(10000000 * ((9 * Rnd())+1))
        Dim SQL As String
        SQL="Insert into Customer(Customer_Name,Customer_ID,Customer_Pwd,Customer_Sex,"
        SQL=SQL + "Customer_Birthday,Customer_Tel,Customer_Address,Customer_Email,Customer_Code) "
        SQL=SQL + "values('" & fullName & "','" & userID & "','" & password & "','" & sex & "',"
        SQL=SQL + "'" & Birthday & "','" & Tel & "','" & Address & "','" & Email & "','" & BeginCode & "')"
                Dim myCommand As OleDbCommand = new OleDbCommand(SQL, myConnection)
          myConnection.Open()
                    myCommand.ExecuteNonQuery()
                Try                 
        Dim mail As MailMessage = New MailMessage
                        mail.To = Email
                        mail.From = "[email protected]"
                        mail.Subject = "启用码"
                        mail.Body = cstr(BeginCode)
                    SmtpMail.Send(mail)
                Finally
                    myConnection.Close()             
        End Try
    Return UserID.ToString()            
            End Function
      

  7.   

    SQL=SQL + "'" & Birthday & "','" & Tel & "','" & Address & "','" & Email & "','" & BeginCode & "')"
    改为!SQL=SQL + "'" & Birthday & "','" & Tel & "','" & Address & "','" & Email & "','" & BeginCode.ToString() & "')"问题应该处在这里BeginCode是Integer类型的。