Webmaster Forum

Bidding Directory   Advertise Here   V7N Directory
Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Coding Forum Problems with your code? Let's hear about it.

Reply
 
LinkBack Thread Tools Display Modes
Old 11-09-2006, 07:03 PM   #1 (permalink)
Contributing Member
 
Izzmo's Avatar
 
Join Date: 11-01-03
Location: Kansas City
Posts: 981
iTrader: 0 / 0%
Latest Blog:
None

Izzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to behold
Send a message via ICQ to Izzmo Send a message via AIM to Izzmo Send a message via MSN to Izzmo Send a message via Yahoo to Izzmo
Question [ASP.NET] How do you connect to a database?

I don't know what wrong, but I just don't get the process of connecting to a database in ASP.NET. It's soo dang confusing. The ironic part of it is, Microsoft said OleDB Connection was easy to use, *bullcrap*.

Anyways, does anyone know how to connect to a database using ASP.NET, and preferably C#, if not, VB is fine. And also, if applicable, how to do a query after connected?

Thanks,
~Izz
__________________
~Izzmo
ZeroWeb Hosting & Design - Customizable hosting for every type of user!
Izzmo is offline  
Add Post to del.icio.us
Reply With Quote
Sponsored Links
SEO Hosting by HostGator  Advertise Here  Buy Blog Links
Old 11-10-2006, 11:06 PM   #2 (permalink)
Inactive
 
Net-Margin's Avatar
 
Join Date: 06-01-06
Location: United Kingdom
Posts: 80
iTrader: 0 / 0%
Latest Blog:
None

Net-Margin is liked by somebodyNet-Margin is liked by somebodyNet-Margin is liked by somebodyNet-Margin is liked by somebody
http://www.google.co.uk/search?hl=en...ith+C%23&meta=

The top link has something to do with OleDB but i'm not sure if it's what you want, I have no clue with ASP.
Net-Margin is offline  
Add Post to del.icio.us
Reply With Quote
Old 11-11-2006, 07:54 AM   #3 (permalink)
Contributing Member
 
Izzmo's Avatar
 
Join Date: 11-01-03
Location: Kansas City
Posts: 981
iTrader: 0 / 0%
Latest Blog:
None

Izzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to behold
Send a message via ICQ to Izzmo Send a message via AIM to Izzmo Send a message via MSN to Izzmo Send a message via Yahoo to Izzmo
It was a good try, but that is referring to MS Access databases
__________________
~Izzmo
ZeroWeb Hosting & Design - Customizable hosting for every type of user!
Izzmo is offline  
Add Post to del.icio.us
Reply With Quote
Old 11-11-2006, 09:49 AM   #4 (permalink)
Inactive
 
reteep's Avatar
 
Join Date: 03-20-06
Location: Germany
Posts: 526
iTrader: 0 / 0%
reteep is a name known to allreteep is a name known to allreteep is a name known to allreteep is a name known to allreteep is a name known to allreteep is a name known to allreteep is a name known to allreteep is a name known to allreteep is a name known to allreteep is a name known to allreteep is a name known to all
Send a message via ICQ to reteep
Cool

Fully depends on the database, if it's SQL Server you need to have a connection string in the web.config:

PHP Code:
<add name="LocalSqlServer" connectionString="data source=xx;initial catalog=xx;Integrated Security=SSPI;"/> 
then example:

PHP Code:
using System.Data.SqlClient;

System.Data.SqlClient.SqlConnection cn;
this.cn = new SqlConnection(System.Web.Configuration.WebConfigurationManager.ConnectionStrings["LocalSqlServer"].ConnectionString);

 
SqlCommand cmd = new SqlCommand();
            
SqlDataReader dr;

            
cmd.Connection this.cn;
            
cmd.CommandText "SELECT kwID FROM xx WHERE userID='" this.UserID "'";

            
cn.Open();
            
dr cmd.ExecuteReader();

            
dr.Read(); // We only need a single Read Run here cuz we want to get the oldest result ~
            
kwID dr["kwID"].ToString();
            
dr.Close(); 
hth
reteep is offline  
Add Post to del.icio.us
Reply With Quote
Old 11-13-2006, 12:14 PM   #5 (permalink)
Contributing Member
 
Izzmo's Avatar
 
Join Date: 11-01-03
Location: Kansas City
Posts: 981
iTrader: 0 / 0%
Latest Blog:
None

Izzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to beholdIzzmo is a splendid one to behold
Send a message via ICQ to Izzmo Send a message via AIM to Izzmo Send a message via MSN to Izzmo Send a message via Yahoo to Izzmo
Finally! Some light!

I'm reading this book: Learn ASP.NET in 21 Days! and I got stuck at the Database part because I couldn't figure out how to connect to my SQL server lol Everything in the book is MS Access.

Thanks reteep!
__________________
~Izzmo
ZeroWeb Hosting & Design - Customizable hosting for every type of user!
Izzmo is offline  
Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum

Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do you connect WordPress to a remote database? Cars-blog Blogging Forum 4 01-14-2008 03:51 AM
unable to connect mabel01 Computers & Internet 11 10-02-2007 02:08 AM
How to Connect Two Systems? dreamsubmitting Computers & Internet 4 04-23-2007 08:56 AM
How to connect 2 computer mich9el Forum Lobby 15 11-13-2003 07:18 AM


Sponsor Links
Get exposure! Get exposure! Find Scripts Web Hosting Directory Get exposure! SEO Blog


All times are GMT -7. The time now is 05:13 AM.
© Copyright 2008 V7 Inc