473,544 Members | 1,818 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using Stored Procedures with a Grid View

Hi,

I'm trying to use Stored Procedures with a Grid View and everytime I try the
update and the delete stored procedures fail. By the way I am doing this
through the wizard.

Is there a sample somewhere on how to do this? When I type in the
statements directly it works, but I really need to be able to call stored
procedures. And the stored procedures work fine in query analyzer.

Thanks!
Jan 11 '06 #1
1 2153
Mimo,

I don't have a full example for you, but I've successfully used sprocs with
my gridview and formview controls in a current project.

I found that for the delete and update sprocs I had to specify the primary
key in the datagrid header like this:

<asp:GridView ID="GridView1" runat="server" AllowPaging="Tr ue"
AllowSorting="T rue"
AutoGenerateCol umns="False" CellPadding="4" DataSourceID="S qlDataSource1"
ForeColor="#333 333"
GridLines="None " PageSize="25" DataKeyNames="p k_InventoryId">

Note the "DataKeyNam es" entry.

Also for my update command, which is in a formview control, I had some drop
down lists that I needed to retrieve values from. I did that inside of the
ItemUpdating event (which fires just before the update) like this:

'---Set drop down parameters
e.NewValues.Ite m("CountryId" ) =
CType(FormView1 .FindControl("C ountrysDropDown List"),
DropDownList).S electedValue
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"mimo" <mi**@discussio ns.microsoft.co m> wrote in message
news:87******** *************** ***********@mic rosoft.com...
Hi,

I'm trying to use Stored Procedures with a Grid View and everytime I try
the
update and the delete stored procedures fail. By the way I am doing this
through the wizard.

Is there a sample somewhere on how to do this? When I type in the
statements directly it works, but I really need to be able to call stored
procedures. And the stored procedures work fine in query analyzer.

Thanks!

Jan 11 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3508
by: M Wells | last post by:
Hi All, I'm wondering if anyone can tell me if it's possible to search for stored procedures by their contents? I tend to leave very descriptive notes in stored procedures and they're beginning to build up in number, so I'm wondering if it's possible to search in Query Analyzer for stored procedures that contain certain words / phrases...
5
3493
by: gilles27 | last post by:
I've ready many of the posts on this and other newsgroups in which people describe working practices for source control of database scripts. We are looking to implement something similar in my current workplace. We have agreed that developers should not modify objects such as views or stored procedures directly, they should check the script...
10
5591
by: serge | last post by:
Using "SELECT * " is a bad practice even when using a VIEW instead of a table? I have some stored procedures that are identical with the difference of one statement in the WHERE clause. If I create a single View and specify also in this View the WHERE clause that is common in these stored procedures, I will have the new stored procecures...
0
2555
by: billmiami2 | last post by:
Perhaps many of you MS Access fanatics already know this, but it seems that stored procedures and views are possible in Jet. I thought I would leave this message just in case it would help anyone. I discovered this the other day while doing some experiments with ADO and ADO.NET. Basically, I wanted to run a stored MS Access query with...
5
1423
by: Hennie | last post by:
Hi Can anybody point me to good articles or sites on using stored proc's in a grid or details view in ASP2.0 Also how can I return the username of the current logged in user as a parameter value in a stored proc? i.e. @UpdatedBy.value = LoginName I am using the wizard in asp.net 2.0 Many thanks
28
72360
by: mooreit | last post by:
The purpose for my questions is accessing these technologies from applications. I develop both applications and databases. Working with Microsoft C#.NET and Microsoft SQL Server 2000 Production and 2005 Test Environments. What is the purpose of a view if I can just copy the vode from a view and put it into a stored procedure? Should I be...
0
1402
by: vanesa | last post by:
Hi, In a client we must begin to program many stored procedures of DB2. The following doubts arise to me that I raise you to see if you can help me: 1. From a point of view of the programming: I need some document or manual (preferably in Spanish) that explains rules on like programming a procedure stored so that their yield is optimal, like...
12
4688
by: brwalias | last post by:
Hi, using .net 2 sql server 2005 Here is my situation: I'm passing a variable in the url from a selection on Page A and need to display the results on the Results page be based on that variable in the url. I would like that variable to trigger a stored and
6
2931
by: insirawali | last post by:
Hi all, I have this problem, i need to know is there a way i cn use the data adapter's update method in this scenario. i have 3 tables as below create table table1{ id1 int identity(1,1) Constraint pk_table1 Primary Key,
0
7431
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7617
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7779
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7387
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5920
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5305
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3424
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1848
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
992
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.