title: Calling Stored Procedures from VB.NET
body: <p>Can anyone please help me on the following:</p>
  
  <p>I have created a SQL Server stored procedure as follows:</p>
  
  <pre><code>create procedure prcGet_sub_menu_list
       @sub_menu     char(5)
  as
  begin
       select
            'menu_code'     =     menu_code
            'menu_name'     =     menu_name
       from sub_menu_master
       where menu_code      =     @sub_menu
  end
  return
  </code></pre>
  
  <p>Now i am calling this procedure from VB.NET, but i get an error like 'Stored procedure prcGet_sub_menu_list expects parameter @sub_menu which was not supplied'. Please help me on the same. The code which i have in VB.NET is as follows:</p>
  
  <pre><code>Imports System.Data
  Imports System.Data.SqlClient
  
  Dim sqlConn as New SqlClient.SqlConnection
  sqlConn.ConnectionString = "........"
  sqlConn.Open()
  
  Dim menuCode as string
  menuCode = cboDetails.selectedItem
  
  Dim sqlCmd as New SqlCommand
  sqlCmd.Connection = Connection.sqlConn
  sqlCmd.CommandType = CommandType.StoredProcedure
  sqlCmd.CommandText = "prcGet_sub_menu_list"
  sqlCmd.Parameter.Add("menuCode", SqlDbType.Char)
  
  Dim sqlDA as New SqlDataAdapter()
  sqlDA.SelectCommand = sqlCmd
  Dim sqlDT as New DataTable
  sqlDA.Fill(sqlDT)
  </code></pre>
  
  <p>This is the code that i have written and it gives me the error:
  'Stored procedure prcGet_sub_menu_list expects parameter @sub_menu which was not supplied'.</p>
  
  <p>Please give me some help on the same.</p>
  
  <p>Regards,
  George</p>