怎样用GridView显示查询结果?
我想将查询的结果显示在一个新的叶面中并且享用GridView显示出来
这样数据绑定就要在代码中写
那我应该怎样写呢?
具体的语句如下:
Dim slt As String = CType(Session("slt"), String)
Dim table As String = CType(Session("table"), String)
Dim SQL As String = CType(Session("SQL"), String)
Dim str As String = "Provider=MSDAORA.1;data source=kksb;user id=kksb;password=kksb2007;"
Dim conn As System.Data.OleDb.OleDbConnection = New System.Data.OleDb.OleDbConnection(str)
Dim strSQL As String = " SELECT " & SQL & " FROM " & table & " WHERE " & slt
Response.Write(strSQL)
Dim comm As System.Data.OleDb.OleDbCommand = New System.Data.OleDb.OleDbCommand(str, conn)
GridView1.DataSource = comm.ExecuteReader
GridView1.DataBind()
conn.Close()
报错说:无效的SQL语句