944,167 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Unsolved
  • Views: 16507
  • ASP.NET RSS
Dec 16th, 2006
0

Connection to sql database in c#

Expand Post »
I am fairly new to asp.net, I am trying to connect to a sql (mysql prefferably) database, it must be using C#. I have been searching all of yesterday and today, I cant figure out how. Could someone help me here (if this has been asked, please point me to a topic)
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Village Idiot is offline Offline
5 posts
since Dec 2006
Dec 17th, 2006
0

Re: Connection to sql database in c#

dude u need to create OdbcConnection.

using this object u can connect to any type of db such as (mssql, oracle, mysql, excel...)

dude i amnot sure abt the stability in using mysql with .net.

sam
Reputation Points: 10
Solved Threads: 1
Junior Poster in Training
web_developer is offline Offline
84 posts
since Mar 2006
Dec 17th, 2006
0

Re: Connection to sql database in c#

Do you have anything on it? just saying do an odbc connection doesnt help me.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Village Idiot is offline Offline
5 posts
since Dec 2006
Dec 19th, 2006
0

Re: Connection to sql database in c#

go to connectionstrings.com,will solve all ur problems related to connection.tell me if you got your problem solved
Reputation Points: 10
Solved Threads: 0
Light Poster
amithasija is offline Offline
44 posts
since Nov 2006
Dec 20th, 2006
0

Re: Connection to sql database in c#

It solves what to give it, but not on what to put it in. what use is a string with no command?

Does anyone know the answer to my question? it cant be that hard.
Last edited by Village Idiot; Dec 20th, 2006 at 12:05 am.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Village Idiot is offline Offline
5 posts
since Dec 2006
Dec 23rd, 2006
0

Re: Connection to sql database in c#

I am at my wits end trying to figure this out, does anyone know how to do this?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Village Idiot is offline Offline
5 posts
since Dec 2006
Dec 23rd, 2006
0

Re: Connection to sql database in c#

send me the string u r using and name of ur machine and database name also.
Reputation Points: 10
Solved Threads: 0
Light Poster
amithasija is offline Offline
44 posts
since Nov 2006
Dec 23rd, 2006
0

Re: Connection to sql database in c#

I just figured it out. Thanks for your time
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Village Idiot is offline Offline
5 posts
since Dec 2006
Dec 17th, 2010
0

Reading data from SQL database through DataReader

ASP.NET Syntax (Toggle Plain Text)
  1. string connectString = @"Data Source=YOURPC\SQLEXPRESS;Initial Catalog=databasename;Integrated Security=True";
  2. SqlConnection con = new SqlConnection(connectString);
  3. con.Open();
  4. string thesql= "select * from product where type_id=" + thistype + " and part_id="+thispart;
  5. SqlCommand cmd = new SqlCommand(thesql, con);
  6. SqlDataReader reader = cmd.ExecuteReader();
  7. while (reader.Read())
  8. {
  9. string order = reader[2].ToString();
  10. Response.Write("Order is " + order+ "<br>");
  11. }
  12. reader.Close();
  13. con.Close();
Last edited by adatapost; Dec 18th, 2010 at 2:26 am. Reason: Added [code] tags.
hhd
Reputation Points: 10
Solved Threads: 0
Newbie Poster
hhd is offline Offline
1 posts
since Dec 2010

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
This thread is currently closed and is not accepting any new replies.
Previous Thread in ASP.NET Forum Timeline: Sales Force
Next Thread in ASP.NET Forum Timeline: Gridview controls first event that gets fired





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC