Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > using stored procedure with parameter

Reply
Thread Tools

using stored procedure with parameter

 
 
sheraz_aries@hotmail.com sheraz_aries@hotmail.com is offline
Junior Member
Join Date: Sep 2007
Posts: 3
 
      09-04-2007
Hi

i am trying to call a stored procedure that contain one parameter (CIty). But for some reason it doesn't display any records ..(i tried the same query in SQL Server Management studio and got the decired record ...so i must be doing something wrong... On the page i have created a textbox and actually thatswhere user enter the city name: the code is given bellow:



<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="CheckingStoreProcedure.aspx.vb" Inherits="GridView_Checking.CheckingStoreProcedure " %>

<!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>

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:AdventureWorksConnectionString %>"

SelectCommand="ViewSelectedRecord" SelectCommandType="StoredProcedure">

<selectParameters >

<asp:ControlParameter Name ="City" ControlID ="TextBox1" Type=String PropertyName= "text"/>

</selectParameters>



</asp:SqlDataSource>



<asp:TextBox ID="TextBox1" runat="server" Style="left: 11px; position: relative;
top: -2px"></asp:TextBox>

<asp:Button ID="Button1" runat="server" Style="left: 60px; position: relative; top: -1px"

Text="Button" />

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4"

DataKeyNames="StudentID" DataMember="DefaultView" DataSourceID="SqlDataSource1"

ForeColor="#333333" GridLines="None" Style="position: relative">





<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />

<Columns>



<asp:BoundField DataField="StudentID" HeaderText="StudentID" ReadOnly="True" SortExpression="StudentID" />

<asp:BoundField DataField="FirstName" HeaderText="FirstName" SortExpression="FirstName" />

<asp:BoundField DataField="LastName" HeaderText="LastName" SortExpression="LastName" />

<asp:BoundField DataField="Course" HeaderText="Course" SortExpression="Course" />

<asp:BoundField DataField="Address" HeaderText="Address" SortExpression="Address" />

<asp:BoundField DataField="YearOfGraduation" HeaderText="YearOfGraduation" SortExpression="YearOfGraduation" />

<asp:BoundField DataField="City" HeaderText="City" SortExpression="City" />





</Columns>

<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />

<EditRowStyle BackColor="#999999" />

<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />

<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />

<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />

<AlternatingRowStyle BackColor="White" ForeColor="#284775" />





</asp:GridView>



</div>

</form>
</body>

</html>





Cheers
Sheraz
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
'Procedure or function <stored procedure name> has too many arguments specified',,,ARGH! Mike P ASP .Net 0 06-19-2006 01:19 PM
get out parameter from oracle stored procedure raymond chiu ASP .Net 1 01-21-2006 07:15 AM
Using query string to pass a value to a stored procedure parameter Machelle Chandler ASP .Net Datagrid Control 0 10-20-2003 11:22 PM
Called a Stored Procedure , decimal parameter Mona ASP .Net 1 06-27-2003 02:08 PM
Call a stored procedure with decimal parameter Mona ASP .Net 2 06-27-2003 01:31 PM



Advertisments
 



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