level 1
acxz520
楼主
我有一个函数 Public Function Execute4Object(ByVal ssql As String) As Object Implements IData.Execute4Object Dim oresult As Object conn = New OleDbConnection(connstring) cmd = New OleDbCommand(ssql, conn) Try conn.Open() oresult = cmd.ExecuteScalar ' MsgBox("1") If Object.Equals(oresult, Nothing) Then Throw New Exception("value unavailable") Else
Execute4Object = oresult
End If Catch ex As Exception Throw New Exception(ex.Message) Finally cmd.Dispose() conn.Close()
End Try
End Function
一个表 三个字段 id ,book_sort, book_sort_id 表名 book_sort 当用 Execute4Object("select id from book_sort where book_sort='"textbox1.text"’ ") 做查询的时候为什么得不到想要的值 而且提示 value unavailable
2011年05月29日 00点05分
1
Execute4Object = oresult
End If Catch ex As Exception Throw New Exception(ex.Message) Finally cmd.Dispose() conn.Close()
End Try
End Function
一个表 三个字段 id ,book_sort, book_sort_id 表名 book_sort 当用 Execute4Object("select id from book_sort where book_sort='"textbox1.text"’ ") 做查询的时候为什么得不到想要的值 而且提示 value unavailable