Results 1 to 4 of 4

Thread: [2005] passing data parameters

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2005
    Location
    New Jersey, USA
    Posts
    119

    [2005] passing data parameters

    I'm plugging a data adapter into a stored procedure in a database. then, i'm filling a dataset with this data, but its telling me i need to pass parameters. How can I detect the required parameters for the procedure, so that i can request them from the user? can this be done through the dataset?

    thank you
    Dim person As New Person
    Person.GrowUp(ByVal school as string, ByVal gang as string, Byval family as string)
    Person.Work
    Dim A as Integer
    For A = 1 to 10
    Person.Marry()
    Person.Divorce()
    Next
    Person.GiveUp()
    Person.Die()

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005] passing data parameters

    Assuming that you're using SQL Server, you can use the SqlConnection.GetSchema method to get that information. Other data providers expose similar functionality.

    Working with the GetSchema Methods

    Having said that, it seems odd to me that you know at design time which sproc to call but you don't know what parameters it requires.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jun 2005
    Location
    New Jersey, USA
    Posts
    119

    Re: [2005] passing data parameters

    the sproc is defined at runtime, with the user choosing one out of a list. thank you for the resource.
    Dim person As New Person
    Person.GrowUp(ByVal school as string, ByVal gang as string, Byval family as string)
    Person.Work
    Dim A as Integer
    For A = 1 to 10
    Person.Marry()
    Person.Divorce()
    Next
    Person.GiveUp()
    Person.Die()

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005] passing data parameters

    Quote Originally Posted by colonel720
    the sproc is defined at runtime, with the user choosing one out of a list. thank you for the resource.
    Seems reasonable. You can use the same functionality to get the list of sprocs too. Calling GetSchema will return a DataTable. You can then bind that DataTable directly to your ComboBox or whatever, setting the DisplayMember to the appropriate column.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width