Protected Sub btnAddSubmit_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnAddSubmit.Click
Dim SQLStatement As String = "INSERT INTO account(firstname, lastname, uname, pass, type)" & " VALUES ('" & fname.Value.ToString & "','" & lname.Value.ToString & "','" & username.Value.ToString & "','" & password.Value.ToString & "','" & Type.Value.ToString & "')"
SaveNames(SQLStatement)
fname.Value = ""
lname.Value = ""
username.Value = ""
password.Value = ""
Type.Value = ""
所有fname.Value.ToString,lname.Value.ToString,uname.Value.ToString,password.Value.ToString,type.Value.ToString显示错误
未声明。由于其保护级别,它可能无法访问。
这些是文本框
<div class="pure-control-group">
<label for="firstname">First Name</label>
<input runat="server" id="fname" type="text" placeholder="Firstname">
</div>
<div class="pure-control-group">
<label for="lastname">Last Name</label>
<input runat="server" id="lname" type="text" placeholder="Lastname">
</div>
<div class="pure-control-group">
<label for="name">Username</label>
<input runat="server" id="username" type="text" placeholder="Username">
</div>
<div class="pure-control-group">
<label for="password">Password</label>
<input runat="server" id="password" type="password" placeholder="Password">
答案 0 :(得分:0)
您应该使用.Text
属性而不是&#39; value&#39;
fname.Text = ""
...
答案 1 :(得分:-1)
如果类后面的代码未声明为public,请尝试将其公开。