-
December 13th, 2013, 04:37 PM
#1
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
-
December 13th, 2013, 09:41 PM
#2
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)
-
December 15th, 2013, 12:49 PM
#3
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.
-
December 16th, 2013, 09:49 AM
#4
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.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|