Step-by-step connection to SQLServer from ASP.Net |
| | | | Submitted on: 11/21/2003 4:21:04 PM
By: Irene V Yuzbasheva
Level: Beginner User Rating:
By 1 Users Compatibility:ASP.NET
Users have accessed this article 662 times. | |
| | Step-by-step instructions on how to connect to the SQL Server from ASP.Net. Instructions include lots of screen shots in the zip file This article has accompanying files | |
|
Terms of Agreement:
By using this article, you agree to the following terms...
1) You may use
this article in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
2) You MAY NOT redistribute this article (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.
3) You may link to this article from another website, but ONLY if it is not wrapped in a frame.
4) You will abide by any additional copyright restrictions which the author may have placed in the article or article's description. | Step-by-step Instruction on How to Connect to Microsoft SQL Server with ASP . Net Created by: Irene Yuzbasheva, 2003
1. Create an ASP.Net project.
2. In the Server Explorer, navigate to the SQL Server to which you want to connect to.
3. Drag and drop table or view on your *.aspx form. This automatically creates SqlConnection and SqlDataAdapter.
4. Right-click on the SqlAdapter1 and select Generate Dataset…
5. This will create DataSet1 along-side with SqlConnection1 and SqlDataAdapter1.
6. Now you are ready to add data controls to your form. In this example, I will add Data Grid. Drag and drop DataGrid control from the Toolbox .. WebForms.
7. Double-click on the form and place code below under Page_Load function: SqlDataAdapter1.Fill (Me.DataSet11, "Companies") DataGrid1.DataSource = Me.DataSet11.Companies Page.DataBind ()
8. Press F5 to test your creation | |
Download article
Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.
Virus note:All files are scanned once-a-day by Planet Source Code for viruses,but new viruses come out every day, so no prevention program can catch 100% of them.
FOR YOUR OWN SAFETY, PLEASE: 1)Re-scan downloaded files using your personal virus checker before using it. 2)NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com
|
Terms of Agreement:
By using this article, you agree to the following terms...
1) You may use
this article in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
2) You MAY NOT redistribute this article (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.
3) You may link to this article from another website, but ONLY if it is not wrapped in a frame.
4) You will abide by any additional copyright restrictions which the author may have placed in the article or article's description. |
|
Report Bad Submission |
|
|
Your Vote! |
See Voting Log |
|
Other User Comments |
11/22/2003 12:29:39 PM: This example adds nothing to the simple
walkthrough built in tot Visual Studion
and commonly quoted in many ASP.Net
books and guides.
It doesn't help if
your server is remote or behind a
firewall or otherwise not available in
the Visual Studio server
explorer.
It also generates lots of
extra code you may not want, in
generating Insert, UPDATE and DELETE
commands in addition to the needed
SELECT command.
|
|
Add Your Feedback! |
Note:Not only will your feedback be posted, but an email will be sent to the code's author in your name.
NOTICE: The author of this article has been kind enough to share it with you. If you have a criticism, please state it politely or it will be deleted.
For feedback not related to this particular article, please click here. |
|