Populating DataSet with DataAdapter from SPs with parameters

  • Thread starter Thread starter shimonsim
  • Start date Start date
S

shimonsim

Hi
I configured Data Adapter to user for select command SP that takes input
parameters. I need to pass this parameters to Data Adapter but Fill method
doesn't take any parameters that would be used as parameters for SP.
How do I pass these parameters to Select Command Object?
Thanks,
Shimon.
 
Thanks for Miha's response.

Hi Shimon,

You can add the parameters to the DataAdapter.SelectCommand before Fill is
called. Try to use the DataAdapter.SelectCommand.Parameters.Add() to add
the parameters for the SP. Please check the following link for reference.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
frlrfsystemdatasqlclientsqlparameterclasstopic.asp

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Thanks to everyone. Is it possible to bind this parameter to a column in
DataSet? From the link you gave me as reference looks like that it could be
done. But there is no code that does it.
In my case I have a column that I could use as parameter for the command but
how would I know if it bound (I created everything using VS.NET wizards)
Thanks,
Shimon.
 
I think I got it.
But it seems that I can't do following:
1. Create new row in the table
2. Set fields that are used as parameters
3. Call adapter Fill method and adapter will use the values that I set for
SelectCommand parameters.
I don't know if this is any better then just setting parameters straight I
am just clearifying if this is possible or not.
Thanks,
Shimon.
 
Hi Shimon,

This is possible. You can add the parameters to the SelectCommand before
you call Fill method. If you can't create a new row in the table, can you
tell me how did you create it?

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
I surely can create new row.
I think that now I got the full picture.
Thanks,
Shimon.
 
Back
Top