Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default Calling a procedure

    How do you call an existing procedure? My database has a procedure called
    "StudentSchedule" with one parameter, @StudentID. I'm trying to fill the
    results in a datagrid with a StoredProcedure command. The grid is not even
    showing on the page.

    SqlCommand cmdSchedule = new SqlCommand("StudentSchedule", this.cnBCC);
    cmdSchedule.CommandType = CommandType.StoredProcedure;

    SqlParameter studID = cmdSchedule.Parameters.Add("@StudentID",
    SqlDbType.NChar, 9);
    studID.Value = this.tbSID.Text.Trim();

    SqlDataAdapter daSchedule = new SqlDataAdapter(cmdSchedule);
    DataSet ds = new DataSet();

    daSchedule.Fill(ds);
    this.dgStudents.DataSource = ds;


    Jon Cosby


    Jon Cosby Guest

  2. Similar Questions and Discussions

    1. #39136 [NEW]: Calling a stored procedure that creates temp table
      From: aspen dot olmsted at alliance dot biz Operating system: Windows XP SP2 PHP version: 5CVS-2006-10-12 (snap) PHP Bug Type: ...
    2. oracle stored procedure calling
      I have two procedures test1 and test2. Resultset is returned by test2. My coldfusion code calls test1. PROCEDURE test1 (in_eid IN NUMBER,...
    3. Calling stored procedure from MysQL 5.0
      I am trying to call stored procedures using <cfquery> in Coldfusion MX 7.0, but I am getting this error: Error Executing Database Query. General...
    4. ASP page calling a stored procedure
      Im trying to call a stored procedure in SQL Server 2000 in ASP.. Heres my code.. ...
    5. Calling stored procedure on connection
      Hello all, I'm having a dickens of a time calling a stored procedure on a connection. Every time I do, it generates an error "Arguments are of the...
  3. #2

    Default Re: Calling a procedure

    Add this line at the end:

    this.dgStudents.DataBind();

    --
    James J. Foster, DotNetCoders
    [url]http://www.dotnetcoders.com[/url]


    "Jon Cosby" <jcosby@mindspring.com> wrote in message
    news:bh8f1d$kf$1@slb2.atl.mindspring.net...
    > How do you call an existing procedure? My database has a procedure called
    > "StudentSchedule" with one parameter, @StudentID. I'm trying to fill the
    > results in a datagrid with a StoredProcedure command. The grid is not even
    > showing on the page.
    >
    > SqlCommand cmdSchedule = new SqlCommand("StudentSchedule",
    this.cnBCC);
    > cmdSchedule.CommandType = CommandType.StoredProcedure;
    >
    > SqlParameter studID = cmdSchedule.Parameters.Add("@StudentID",
    > SqlDbType.NChar, 9);
    > studID.Value = this.tbSID.Text.Trim();
    >
    > SqlDataAdapter daSchedule = new SqlDataAdapter(cmdSchedule);
    > DataSet ds = new DataSet();
    >
    > daSchedule.Fill(ds);
    > this.dgStudents.DataSource = ds;
    >
    >
    > Jon Cosby
    >
    >

    James J. Foster Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139