Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 4th, 2007, 05:33 PM
Authorized User
 
Join Date: May 2007
Posts: 73
Thanks: 4
Thanked 0 Times in 0 Posts
Default usin g stored procedure with parameter

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
__________________
Cheers
Sheraz
 
Old September 5th, 2007, 12:27 AM
Friend of Wrox
 
Join Date: Aug 2006
Posts: 109
Thanks: 0
Thanked 0 Times in 0 Posts
Default

man post the procedure




Nothing is impossible. The impossible only takes longer. "Digital Fortress, Dan Brown"





Similar Threads
Thread Thread Starter Forum Replies Last Post
Pass XML parameter to stored procedure BCullenward Classic ASP Databases 3 September 10th, 2008 02:07 PM
Query Parameter of a Stored Procedure tarang SQL Server 2000 4 July 25th, 2007 11:43 AM
How to pass a parameter to a stored procedure? MaxGay2 VB.NET 2002/2003 Basics 1 November 8th, 2006 02:48 PM
Passing a parameter value to Stored Procedure mcinar SQL Server 2000 9 October 3rd, 2004 09:42 PM
Pass an Array as a Parameter to a Stored Procedure booksnore2 Oracle 0 August 31st, 2004 09:20 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.