DataAdapter.Fill not returning results
Due to contract rules I cannot post exact code on my issue. However if I describe the issue, someone may have had the same issue.
I have a common routine that is passed a given SQL table name. Given this table name, I access and call a stored procedure with two parameters. Then I access the stored procedure via "DataAdapter.fill(ds)" where "ds" is a dataset object.
This process works for 11 out of 12 of my stored procedures and the fill does fill out the dataset. However, 1 stored proc is not filling the "ds" on the fill command. I can call the stored procedure in MS SQL Manager fine and it works. What is coming back from the "fill" is a bogus return dataset of the literal "1" or sometimes "6".
I have tried everthing I know and no luck getting this one to work. As a work-around, I embeded the code with the T-SQL script to get the table data and that works too.
Ideas anyone? Thanks
Re: DataAdapter.Fill not returning results
Might be the name? Provide that, with some hidden fields. googleDB would show as MyDb
Otherwise, post the LOG files (with same advice)
Re: DataAdapter.Fill not returning results
Does your stored procedure actually return a dataset?
You can always post a sample code instead of the exact working code that you have in your application.
Re: DataAdapter.Fill not returning results
try
{
DataSet ds = new DataSet();
SqlConnection con = new SqlConnection(GetConnectionString());
SqlCommand cmd = new SqlCommand(GetStoredProcedure(tableName), con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
da = new SqlDataAdapter(cmd);
da.SelectCommand.CommandType = CommandType.StoredProcedure;
da.SelectCommand.Parameters.Add("@Parm1", SqlDbType.VarChar).Value = Parm1;
da.SelectCommand.Parameters.Add("@Parm2_ID", SqlDbType.VarChar).Value = Parm2;
if (con.State == ConnectionState.Closed)
con.Open();
int i = da.Fill(ds);
if (con.State == ConnectionState.Open)
con.Close();
}
---------------------------------------------------------------------
GetStoredProcedure is a method that will provide the stored procedure available on the server depending onthe table name being passed.