为什么这里老是提醒我标准数据类型不匹配?代码如下
ProtectedSubButton1_Click(ByValsenderAsObject,ByValeAsSystem.EventArgs)HandlesButton1...
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim myconnection As OleDbConnection
Dim mycnstr As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("App_data/db1.mdb")
myconnection = New OleDbConnection(mycnstr)
Dim sql As String = ""
Dim myxb As Boolean = False
If (RadioButtonList1.SelectedValue = "男") Then
myxb = True
Else
myxb = False
End If
sql = "insert into 招聘信息(姓名,性别,年龄,学历,联系方式,工作经历) values('" & xm.Text & "','" & myxb & "','" & nl.Text & "','" & xl.Text & "','" & lxfs.Text & "','" & gzjl.Text & "')"
Dim mycom As OleDbCommand
myconnection.Open()
mycom = New OleDbCommand
mycom = New OleDbCommand(sql, myconnection)
mycom.ExecuteNonQuery()
myconnection.Close()
Response.Write("<script language='javascript'>alert('提交成功!');</script>")
End Sub 展开
Dim myconnection As OleDbConnection
Dim mycnstr As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("App_data/db1.mdb")
myconnection = New OleDbConnection(mycnstr)
Dim sql As String = ""
Dim myxb As Boolean = False
If (RadioButtonList1.SelectedValue = "男") Then
myxb = True
Else
myxb = False
End If
sql = "insert into 招聘信息(姓名,性别,年龄,学历,联系方式,工作经历) values('" & xm.Text & "','" & myxb & "','" & nl.Text & "','" & xl.Text & "','" & lxfs.Text & "','" & gzjl.Text & "')"
Dim mycom As OleDbCommand
myconnection.Open()
mycom = New OleDbCommand
mycom = New OleDbCommand(sql, myconnection)
mycom.ExecuteNonQuery()
myconnection.Close()
Response.Write("<script language='javascript'>alert('提交成功!');</script>")
End Sub 展开
1个回答
展开全部
请把sql = "insert into 招聘信息(姓名,性别,年龄,学历,联系方式,工作经历) values('" & xm.Text & "','" & myxb & "','" & nl.Text & "','" & xl.Text & "','" & lxfs.Text & "','" & gzjl.Text & "')"
中的myxb,改成myxb.ToString,问题应该错在这里.
因为mdb数据库字段,没有Boolean属性.
中的myxb,改成myxb.ToString,问题应该错在这里.
因为mdb数据库字段,没有Boolean属性.
来自:求助得到的回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询