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