Hi,
I am not getting any results from stored procedure ,passing a parameter to the stored procedure . My code is

<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Web.UI" %>
<script language="VB" runat="server">
    Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
        Trace.Write("This msg is from checkdetails")
      
        Dim aCol As Integer
        Dim aNumColumns As Integer
       

        Try
            Dim MyConnection As SqlConnection = New SqlConnection()
            MyConnection.ConnectionString = ConfigurationManager.ConnectionStrings("StudentInfoSystemConnectionString").ConnectionString
            
            Dim MyCommand As SqlCommand = New SqlCommand()
            MyCommand.CommandText = "sp_listall_reporttables"
            MyCommand.CommandType = CommandType.StoredProcedure
            MyCommand.Connection = MyConnection
            
            Dim IdParam As SqlParameter = New SqlParameter("@tableName", "calendar_Check1")
            IdParam.ParameterName = "@tableName"
            IdParam.DbType = DbType.String
            IdParam.Direction = ParameterDirection.Input
                    
              
            MyCommand.Connection.Open()
            MyCommand.Parameters.Add(IdParam)
           
            Dim Adapter As SqlDataAdapter = New SqlDataAdapter(MyCommand)
            Dim DataSet As DataSet = New DataSet("List Tables")
                             
            Adapter.Fill(DataSet)
            gdCheckDetails.DataSource = DataSet.Tables(0)
                     
            MyCommand.Dispose()
            MyConnection.Dispose()
            
            Catch Ex As Exception
            Throw New Exception("Error setting column captions.", Ex)

        End Try
 
    
    End Sub
</script>  
  
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
     <strong>Sub Reports</strong>
          <asp:gridview ID="gdCheckDetails"  runat="server" >
         </asp:gridview>
             
    </div>
    </form>
</body>
</html>

Thanks in advance

Looks that problem is in the sp. Please show the stored procedure

Yes Surely the problem is in Stored Procedure
Just forward your stored Procedure

I found out what the problem was. My Stored procedure doesn't have any output .So I thought in ASP.net will display the column headers of the resultset like in SqlServer.When I execute in the sqlserver it was showing the column headers ,so I was expecting that in ASP.net.

Thanks Guys, responding to my question

if it solved please mark it as SOLVED...
Please do it..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.