【求助!!】执行查询时出现的一个问题(附代码)
我想执行一个由search表生成search1的查询,代码如下:
Try
Dim con As OleDb.OleDbConnection
Dim fullname As String = AppDomain.CurrentDomain.BaseDirectory()
Dim cstring As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & fullname & "db1.mdb "
con = New OleDb.OleDbConnection(cstring)
Dim sqlstr As String = "select * into search1 from search order by val(mid(f1,2,2)) "
Dim sql As New OleDbCommand(sqlstr, con)
con.Open()
sql.ExecuteNonQuery()
con.Close()
Catch
MsgBox( "错误号: " & Err.Number & "错误描述: " & Err.Description)
End Try
可是执行后在sql.ExecuteNonQuery()处报错说是“至少一个参数没有被指定值”,不知道是什么原因,请各位指教
------解决方案--------------------val(mid(你的字段名,2,2))
取你的字段名的第3、4两位字符,转换为数值型