Result is not getting from Stored Procedure

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Aug 2008
Posts: 3
Reputation: rk1 is an unknown quantity at this point 
Solved Threads: 0
rk1 rk1 is offline Offline
Newbie Poster

Result is not getting from Stored Procedure

 
0
  #1
Aug 1st, 2008
Hi,
I am not getting any results from stored procedure ,passing a parameter to the stored procedure . My code is

  1. <%@ Import Namespace="System.Data" %>
  2. <%@ Import Namespace="System.Data.SqlClient" %>
  3. <%@ Import Namespace="System.Web.UI" %>
  4. <script language="VB" runat="server">
  5. Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
  6. Trace.Write("This msg is from checkdetails")
  7.  
  8. Dim aCol As Integer
  9. Dim aNumColumns As Integer
  10.  
  11.  
  12. Try
  13. Dim MyConnection As SqlConnection = New SqlConnection()
  14. MyConnection.ConnectionString = ConfigurationManager.ConnectionStrings("StudentInfoSystemConnectionString").ConnectionString
  15.  
  16. Dim MyCommand As SqlCommand = New SqlCommand()
  17. MyCommand.CommandText = "sp_listall_reporttables"
  18. MyCommand.CommandType = CommandType.StoredProcedure
  19. MyCommand.Connection = MyConnection
  20.  
  21. Dim IdParam As SqlParameter = New SqlParameter("@tableName", "calendar_Check1")
  22. IdParam.ParameterName = "@tableName"
  23. IdParam.DbType = DbType.String
  24. IdParam.Direction = ParameterDirection.Input
  25.  
  26.  
  27. MyCommand.Connection.Open()
  28. MyCommand.Parameters.Add(IdParam)
  29.  
  30. Dim Adapter As SqlDataAdapter = New SqlDataAdapter(MyCommand)
  31. Dim DataSet As DataSet = New DataSet("List Tables")
  32.  
  33. Adapter.Fill(DataSet)
  34. gdCheckDetails.DataSource = DataSet.Tables(0)
  35.  
  36. MyCommand.Dispose()
  37. MyConnection.Dispose()
  38.  
  39. Catch Ex As Exception
  40. Throw New Exception("Error setting column captions.", Ex)
  41.  
  42. End Try
  43.  
  44.  
  45. End Sub
  46. </script>
  47.  
  48. <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
  49.  
  50. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  51.  
  52. <html xmlns="http://www.w3.org/1999/xhtml">
  53. <head runat="server">
  54. <title>Untitled Page</title>
  55. </head>
  56. <body>
  57. <form id="form1" runat="server">
  58. <div>
  59. <strong>Sub Reports</strong>
  60. <asp:gridview ID="gdCheckDetails" runat="server" >
  61. </asp:gridview>
  62.  
  63. </div>
  64. </form>
  65. </body>
  66. </html>

Thanks in advance
Last edited by peter_budo; Aug 1st, 2008 at 1:50 pm. Reason: Keep It Organized - please use [code] tags
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 43
Reputation: sebastian3 is an unknown quantity at this point 
Solved Threads: 1
sebastian3 sebastian3 is offline Offline
Light Poster

Re: Result is not getting from Stored Procedure

 
0
  #2
Aug 6th, 2008
Looks that problem is in the sp. Please show the stored procedure
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 14
Reputation: vishakha_ate is an unknown quantity at this point 
Solved Threads: 0
vishakha_ate vishakha_ate is offline Offline
Newbie Poster

Re: Result is not getting from Stored Procedure

 
0
  #3
Aug 8th, 2008
Yes Surely the problem is in Stored Procedure
Just forward your stored Procedure
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 3
Reputation: rk1 is an unknown quantity at this point 
Solved Threads: 0
rk1 rk1 is offline Offline
Newbie Poster

Re: Result is not getting from Stored Procedure

 
0
  #4
Aug 8th, 2008
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
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 14
Reputation: vishakha_ate is an unknown quantity at this point 
Solved Threads: 0
vishakha_ate vishakha_ate is offline Offline
Newbie Poster

Re: Result is not getting from Stored Procedure

 
0
  #5
Aug 11th, 2008
if it solved please mark it as SOLVED...
Please do it..
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC