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 March 31st, 2007, 02:04 PM
Registered User
 
Join Date: Mar 2007
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Beginner :: Need help to bind the data in GridView

I m beginner for ASP.Net 2005 with C# and SQL Server 2005.

I have created the form which contains many asp standard controls on it like label,textbox,checkbox,dropdownlist,command button.
The command button used are only to execute the different queries on click event.
I have put the GridView control which is used to show the database stored related to that form.
I m using SQL DataSource control for the connection.

Now,my problem is i m not able to write the proper SQL queries which insert,delete,update or select from the GridView and Standard Controls.

In short,I have a command button set up on a form to run a SQL pass-through insert query after several field are filled in standard controls but I can't get .Please anyone could help me to provide the sample source code related to above controls used in the same form.

Thanxs


 
Old March 31st, 2007, 02:05 PM
Registered User
 
Join Date: Mar 2007
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Please help me with some sample source code i m really in urgent need...
Want to create the project thenafter.

<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:companymaster %>"
DeleteCommand="DELETE FROM [Categories]
WHERE [CategoryID] = @CategoryID"
InsertCommand="INSERT INTO [Categories]
([CategoryName], [Description])
VALUES (@CategoryName, @Description)"
UpdateCommand="UPDATE [Categories] SET
[CategoryName] = @CategoryName,
[Description] = @Description
WHERE [CategoryID] = @CategoryID">
</asp:SqlDataSource>
<asp:GridView ID="GridView1" runat="server"/>

I have used the above code for the sql queries with sqldatasource control and gridview control.
Is any connection other than this required ??
What should be written in web.config ??

Pls provide proper guideline...

Is the code enough to complete what i needed if it's incomplete then pls help out

 
Old April 2nd, 2007, 01:21 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Quote:
quote:Is the code enough to complete what i needed if it's incomplete then pls help out
Why don't you try it out?

If it works, then it's enough code, otherwise it isn't...

But seriously, it would help if you'd post a bit more detail, like an error message for example.

And yes: with this syntax:

"<%$ ConnectionStrings:companymaster %>"

you need a connection string called companymaster in the connectionStrings element of the web.config.

Take a look at www.connectionstrings.com for some examples.

Imar

---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Beginner :: Need help to bind the data in GridView kajal C# 3 April 3rd, 2007 06:34 AM
Beginner :: Need help to bind the data in GridView kajal SQL Server 2005 1 March 31st, 2007 04:26 PM
Beginner :: Need help to bind the data in GridView kajal Visual Studio 2005 2 March 31st, 2007 04:26 PM
Data Bind Template Controls in Gridview wirerider ASP.NET 2.0 Basics 5 February 4th, 2007 07:20 AM
Bind GridView to Dataset bob_clegg ASP.NET 2.0 Professional 1 November 21st, 2006 08:57 PM





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