Error on DataAdapter.Fill in .NET

Hi,

I have a working client application written in Delphi, which connects to a custom Data Abstract Server.
I would like to write a similar client application in .NET.
I can login in the custom appserver, but when I’m trying to fetch data the following error occurs:

Any idea on how to solve this?

As the error message states, the dataset instance you try to provide as the 1st argument has no DataTables defined in it. DataAdapter cannot fetch data if no place where to put that data was provided.

The solution is to provide properly formed DataSet instance containing DataTables named after tables that will be fetched from the server.

Thanks for the answer. How can I properly set up the dataset if I want to fill it with the result of a not predefined (e.g. dynamically created) sql query?

Create the target dataset as

DataSet ADataset = new DataSet();
ADataset.Tables.Add("SQLResult");

not as

Data ADataset = new Data();

This should provide the data table instance required to put the request result into.

I tried to create the table manually, but I still get this error:

Seems your RemoteDataAdapter instance is not configured properly. Here is the working code that accesses data in the similar manner:

DataSet ds = new DataSet();
ds.Tables.Add("SQLResult");

var rda = new RemoteDataAdapter();
rda.TargetUrl = "http://localhost:8099/bin";


rda.DataRequestCall.Parameters.Clear();
rda.DataRequestCall.Parameters.Add("aSQLText", "String", RemObjects.SDK.ParameterDirection.In);
rda.DataRequestCall.Parameters.Add("aIncludeSchema", "Boolean", RemObjects.SDK.ParameterDirection.In);
rda.DataRequestCall.Parameters.Add("aMaxRecords", "Integer", RemObjects.SDK.ParameterDirection.In);
rda.DataRequestCall.Parameters.Add("Result", "Binary", RemObjects.SDK.ParameterDirection.Result);
rda.DataRequestCall.OutgoingTableNamesParameter = null;
rda.DataRequestCall.IncomingDataParameter = "Result";

rda.DataRequestCall.MethodName = "SQLGetData";
rda.DataRequestCall.ParameterByName("aSQLText").Value = "select * from orderdetails";
rda.DataRequestCall.ParameterByName("aMaxRecords").Value = 100;
rda.DataRequestCall.ParameterByName("aIncludeSchema").Value = true;

rda.Fill(ds, true);

Hope that helps

1 Like