Click here to Skip to main content
15,890,557 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to extract links from a div Pin
faiza.butt891-Oct-13 4:20
faiza.butt891-Oct-13 4:20 
QuestionHow to get url Pin
DollieBSP30-Sep-13 11:50
DollieBSP30-Sep-13 11:50 
AnswerRe: How to get url Pin
Ravi Bhavnani30-Sep-13 12:18
professionalRavi Bhavnani30-Sep-13 12:18 
AnswerRe: How to get url Pin
Ravi Bhavnani30-Sep-13 12:21
professionalRavi Bhavnani30-Sep-13 12:21 
GeneralRe: How to get url Pin
DollieBSP30-Sep-13 12:26
DollieBSP30-Sep-13 12:26 
GeneralRe: How to get url Pin
Mycroft Holmes30-Sep-13 12:47
professionalMycroft Holmes30-Sep-13 12:47 
GeneralRe: How to get url Pin
Ravi Bhavnani30-Sep-13 15:09
professionalRavi Bhavnani30-Sep-13 15:09 
QuestionI am getting an error when trying to save an XLS to .DBF file. Pin
Glen Childs30-Sep-13 5:48
Glen Childs30-Sep-13 5:48 
Hello,

I am getting an error when trying to save my XLS to .DBF. The error is: An OLE DB Provider was not specified in the ConnectionString. An example would be, 'Provider=SQLOLEDB;'. I am getting the error at this line of code: var cnn = new OleDbConnection(cnnStr);

C#
//Connection string for SQL
            var cnnStr = @"Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=C:\file.xls;ReadOnly=1;ColNameHeader=False";

            //Creates a new OleDbConnection with an argument of cnnStr
            var cnn = new OleDbConnection(cnnStr);

            //creates new datatable in memory to store the read excel spreadsheet.
            var dt = new DataTable();

            try
            {
                //Opens the new connection called "cnn". 
                cnn.Open();

                string sqlConnectionString = "Data Source=Zach-PC;Initial Catalog=master;Integrated Security=True";


                var schemaTable = cnn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
                if (schemaTable.Rows.Count < worksheetNumber) throw new ArgumentException("The worksheet number provided cannot be found in the spreadsheet");
                //string worksheet = schemaTable.Rows[worksheetNumber - 1]["table_name"].ToString().Replace("'", "");
                string sql = String.Format("select * from [{0}]", sqlConnectionString);
                var da = new OleDbDataAdapter(sql, cnn);
                da.Fill(dt);
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                // close resources
                cnn.Close();
            }


Any pointers? Poke tongue | ;-P
Regards,

Glen

AnswerRe: I am getting an error when trying to save an XLS to .DBF file. Pin
Richard Deeming30-Sep-13 5:59
mveRichard Deeming30-Sep-13 5:59 
GeneralRe: I am getting an error when trying to save an XLS to .DBF file. Pin
Glen Childs30-Sep-13 6:05
Glen Childs30-Sep-13 6:05 
GeneralRe: I am getting an error when trying to save an XLS to .DBF file. Pin
Richard MacCutchan30-Sep-13 6:15
mveRichard MacCutchan30-Sep-13 6:15 
GeneralRe: I am getting an error when trying to save an XLS to .DBF file. Pin
Glen Childs30-Sep-13 6:19
Glen Childs30-Sep-13 6:19 
SuggestionRe: I am getting an error when trying to save an XLS to .DBF file. Pin
Richard MacCutchan30-Sep-13 6:46
mveRichard MacCutchan30-Sep-13 6:46 
GeneralRe: I am getting an error when trying to save an XLS to .DBF file. Pin
Jason Gleim30-Sep-13 7:52
professionalJason Gleim30-Sep-13 7:52 
GeneralRe: I am getting an error when trying to save an XLS to .DBF file. Pin
Richard Deeming30-Sep-13 8:19
mveRichard Deeming30-Sep-13 8:19 
GeneralRe: I am getting an error when trying to save an XLS to .DBF file. Pin
Glen Childs30-Sep-13 22:43
Glen Childs30-Sep-13 22:43 
AnswerRe: I am getting an error when trying to save an XLS to .DBF file. Pin
Richard Deeming1-Oct-13 1:33
mveRichard Deeming1-Oct-13 1:33 
GeneralRe: I am getting an error when trying to save an XLS to .DBF file. Pin
Glen Childs1-Oct-13 3:10
Glen Childs1-Oct-13 3:10 
QuestionSQL XML TYPE Pin
Member 1030679730-Sep-13 4:44
Member 1030679730-Sep-13 4:44 
AnswerRe: SQL XML TYPE Pin
Eddy Vluggen30-Sep-13 7:29
professionalEddy Vluggen30-Sep-13 7:29 
GeneralRe: SQL XML TYPE Pin
Member 103067971-Oct-13 4:44
Member 103067971-Oct-13 4:44 
QuestionSetting a default and maximum number in a textbox. New to C#. Please help Pin
Mandyy1429-Sep-13 19:58
Mandyy1429-Sep-13 19:58 
SuggestionRe: Setting a default and maximum number in a textbox. New to C#. Please help Pin
Richard MacCutchan29-Sep-13 21:15
mveRichard MacCutchan29-Sep-13 21:15 
GeneralRe: Setting a default and maximum number in a textbox. New to C#. Please help Pin
PIEBALDconsult30-Sep-13 5:09
mvePIEBALDconsult30-Sep-13 5:09 
GeneralRe: Setting a default and maximum number in a textbox. New to C#. Please help Pin
Amol_B30-Sep-13 23:14
professionalAmol_B30-Sep-13 23:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.