Dynamic SQL generation is not supported against a SelectCommand ...


I

Irfan

hi,
I am getting the following error.
Dynamic SQL generation is not supported against a SelectCommand that does
not return any base table information

when i try to use da.update

I squeezed my program to just few lines to know the reason for this error.
Atlast,
i found that if i am using the stored procedures to get the data, then this
error is caused, If i simply use

Dim cmd As New OleDbCommand("select * from table1", con)
it does not give any error.

But i need to use stored procedures in my program , could someone please
tell if their is any work around

Here is the few lines of code

Dim con As New OleDbConnection(ConnString)
da = New OleDbDataAdapter

ds = New DataSet()

Dim cmd As New OleDbCommand("select * from table1", con)

' Dim cmd As New OleDbCommand("q1", con)

' cmd.CommandType = CommandType.StoredProcedure

da.SelectCommand = cmd

da.FillSchema(ds, SchemaType.Source, "myTable")

da.Fill(ds, "mytable")

Dim cmdbuider As New OleDbCommandBuilder(da)

DataGridView1.DataSource = ds

DataGridView1.DataMember = "mytable"
 
Ad

Advertisements

C

Cor Ligthert

Irfan,

In my opinion does this not need a workaround, this sounds if your stored
procedure is wrong.

Is that as simple as you show now.
Otherwise try it first in the way you did now, however not as stored
procedure but as now with commandtext.

I hope this helps,

Cor
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top