|
 |
ASP.NET 3.5 Basics If you are new to ASP or ASP.NET programming with version 3.5, this is the forum to begin asking questions. Please also see the Visual Web Developer 2008 forum. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 3.5 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
|
 |
|
|

May 15th, 2008, 04:33 PM
|
Registered User
|
|
Join Date: Mar 2008
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Connecting to MSSQL-- All about it
I'm just starting to learn ASP.NET (3.5) and I've gotten most of it down, but my failure to use a database is really crippling my learning ability.
How do I connect to MSSQL? I have Godaddy so they provide me with the username, password, url, etc. If I could get a few examples for the following it would really help ALOT!
- Connect to database.
- Retrieve all of the contents from a certain table.
- Get an average from a table (or column, I can't quite remember which it would be).
I really have tried to get this down so don't think I'm just being a lazy person...I even went to the local Barnes and Nobles and bought Beginning ASP.NET 3.5 book to learn ASP. I just can't figure out how to connect to a database though :\
I would really appreciate it if you could give me an example and tell me how to display at least one of the processes above. I'm guessing I'll use the <script> method? As opposed to behind code?
|

May 16th, 2008, 03:23 AM
|
 |
Wrox Author
Points: 71,804, Level: 100 |
|
|
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,050
Thanks: 80
Thanked 1,581 Times in 1,558 Posts
|
|
Hi there,
It all depends on what you want to do, and how you want to do it. Beginning ASP.NET 3.5 covers accessing databases in chapters 11 through 14. It uses concepts like LINQ and the built-in web controls for data access.
The book Professional ASP.NET 3.5 digs deeper into "manual data access" using objects like Connections, DataReaders and DataSets.
You can also check out the ADO.NET quick starts:
http://www.dotnetjunkies.ddj.com/qui...soverview.aspx
http://quickstarts.asp.net/Quickstar...wcontents.aspx
Some of the guides may seem outdated, but most of the concepts still apply. For example, to access a database and get some data out, check out the SqlDataReader example:
http://www.dotnetjunkies.ddj.com/qui...ooverview3.src
There's a lot more information available, but it's difficult to give you precise pointers as I don't know what exactly you are looking for.
My book (and the Pro edition) is a good starting point to get familiar with the general concepts. Google and these forums would then your next step to get detailed answers to detailed questions.
Hope this helps; if not: please let me know.
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
|

May 16th, 2008, 01:11 PM
|
Registered User
|
|
Join Date: Mar 2008
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Yea that helps Imar. I bought your book (ASP.NET 3.5) when I first decided I wanted to learn ASP and it really helped, so great job on it. I just bought the Professional edition several days ago, so I will look in there as I guess that's pretty much what I'm wanting to do...connect manually.
As far as what I'm trying to do, for now I just want to make a simple rating system so that I can call the data out of my database and average to a whole number, then display the number. I also need to write a simple bit of code that will add data to the database (the rating others have given it) so it will be added into later.
I did this on PHP easily using MySQL, but getting the whole database thing working in ASP has proven to be a challenge. If someone [u]wants</u> to write some sample code that would be excellent, but I'm definately not relying on someone to do so.
|

May 17th, 2008, 04:23 AM
|
 |
Wrox Author
Points: 71,804, Level: 100 |
|
|
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,050
Thanks: 80
Thanked 1,581 Times in 1,558 Posts
|
|
You may want to take a look here:
http://p2p.wrox.com/topic.asp?TOPIC_ID=71354
It shows some basic code to connect to a database, execute a select statement and working with the results.
You may also want to take a look at chapter 8 of the Professional ASP.NET 3.5 book as it digs deeper into manually accessing databases.
From here, things should be similar to what you did in PHP. E.g. you calculate an average in your SQL statement or in .NET code and somewhere display the results.
If you have specific questions about some parts of the code, feel free to post them here.
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |