Results 1 to 2 of 2

Thread: How to.....pass a variable to a SP

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2003
    Posts
    3

    Question How to.....pass a variable to a SP

    Hello,

    I just started to learn VB .NET.
    I made a db program with sqlserver.

    On form 1(name, address, aso) I have a searchbutton, by clicking on it a new form 2 with datagrid appears. I want to pass the value of one cell to a sp belonging to form 1 to fill this form.

    I allready have this value, but now how to pass to a sp?? If I close this form I lost the value.

    Can somebody help me or show me the way to do this.

    Thanks in advance

    Hans

  2. #2
    Addicted Member WALDO's Avatar
    Join Date
    Aug 2002
    Location
    Swing of Prussia, PA
    Posts
    244
    Clearly there are more options than this, but this is just a basic "off the top of my head" piece of code.
    VB Code:
    1. Dim cmd As New SqlClient.SqlCommand(strConnectionString)
    2. Dim prm As New Parameter(strParamName, ParamValue)
    3. cmd.Parameters.Add(prm)
    4. cmd.ExecuteNonQuery(strSPName)

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