Last post Oct 20, 2011 09:53 PM by Decker Dong - MSFT
Oct 19, 2011 08:48 AM|Naraayanan|LINK
Hi all ,
I am new for this Language(ASP.NET).SO Could you please explain How to Use SQL Datasoruce in ASP.Net. now i am working on small Project .It is called "Registration Form" In this form ,First Name , Last Name, Age (Should not greater than 80 and Less than
25).Date of birth (It should be selected and input format like (DD/MM/YYYY) and User views in the Gridview without refershing a Page.Please Help me .
Thanks in Advanced
Oct 19, 2011 08:54 AM|Mikesdotnetting|LINK
SqlDataSource controls are intended to facilitate communication between the web page and a database. For more informaiton, see this:
Oct 19, 2011 09:00 AM|Schmakt|LINK
Are you having a specific problem?
You should be able to simply do something like this:
<asp:GridView Id="gv1" runat="server" DataSourceId="sds1"></asp:Gridview>
<asp:SqlDataSource" Id="sds1" runat="server" ConnectionString="[YourString]" SelectCommand="[YourSQLStatement]" />
the formatting and filtering you are talking about can all happen within your SQL statement, so something like:
SELECT Id, FirstName, LastName, Age, CONVERT(VARCHAR(10), DateOfBirth, 111) WHERE DATEDIFF(year, DateOfBirth, GetDate()) BETWEEN 25 AND 80
(my syntax is probably a little off, but that should be close...)
Oct 19, 2011 09:09 AM|sandy060583|LINK
Here is the very good example written by MuddasarKhan. Hope this will help .
Oct 20, 2011 09:53 PM|Decker Dong - MSFT|LINK
How to Use SQL Datasoruce in ASP.Net.
SqlDataSource is a very important datasource control that is widely used to select, insert, delete or update records and show them on the GridView, you can reguard SqlDataSource is a bridge that connects database with data presentation controls together.
For more about SqlDataSource, you can refer the detailled torturial at:
User views in the Gridview without refershing a Page
To deal with this, I'm afraid you have to use UpdatePanel (AJAX Technology), where you can put a GridView inside.