How do you connect to a sql database using C#

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: Jan 2009
Posts: 2
Reputation: mr.mukesh is an unknown quantity at this point 
Solved Threads: 0
mr.mukesh mr.mukesh is offline Offline
Newbie Poster

Re: How do you connect to a sql database using C#

 
0
  #11
Jan 8th, 2009
how do you connect to a Excel database using c#
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 137
Reputation: PoovenM is on a distinguished road 
Solved Threads: 11
PoovenM PoovenM is offline Offline
Junior Poster

Re: How do you connect to a sql database using C#

 
0
  #12
Jan 8th, 2009
Hmmm, perhaps I'm mistaken but there are no 'Excel databases.' I think you simply wish to read from an Excel file > that is, a spreadsheet. In which case, there are probably (or rather must be) API's out there and a Google search will definitely aid you in that.

Or perhaps you mean to access a Microsoft Access database?
Reply With Quote Quick reply to this message  
Join Date: Nov 2009
Posts: 1
Reputation: kunalsingh4u is an unknown quantity at this point 
Solved Threads: 0
kunalsingh4u kunalsingh4u is offline Offline
Newbie Poster
 
0
  #13
5 Days Ago
can we use dataset in console mode and how
Reply With Quote Quick reply to this message  
Join Date: May 2009
Posts: 2
Reputation: LesF is an unknown quantity at this point 
Solved Threads: 0
LesF LesF is offline Offline
Newbie Poster
 
0
  #14
5 Days Ago
Originally Posted by mr.mukesh View Post
how do you connect to a Excel database using c#
You can use one of the Microsoft database connectors, if you have it installed, some may be provided by installing Office or other products. Your DSN string will be something like:

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\MyExcel.xls;Extended Properties="Excel 8.0;HDR=Yes;IMEX=1";

at least, if you are using the Jet OLEDB type connection. There are others, see http://www.connectionstrings.com/ for better informed examples.

This will allow you to access a table within a worksheet, the HDR=Yes tells it to expect a row of column names at the top, you have to handle the data types yourself, I think. I have working code examples at work someplace but nothing available here.
Reply With Quote Quick reply to this message  
Reply

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC