Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to retrive a character with select statment from excel sheet

Posted on 2009-04-12
1
Medium Priority
?
959 Views
Last Modified: 2013-12-17
Hello,
I am trying to get some records from an Excel sheet (Order number, City, Phone), i need the order number to start and end with a start  * .. i am getting this error: The Provider Could not detirmin Double value.
below is the code am using
string connectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + dlg.FileName + @";Extended Properties=""Excel 8.0;HDR=YES;""";
                OleDbConnection cnn = new OleDbConnection(connectionString);
                OleDbDataAdapter da;
                DataSet1 ds;
                string sql = @"Select" + "'*'" + "+OrderNumber+" + "'*'" + " as OrderNumber,City,Phone FROM [sheet1$] WHERE OrderNumber > 0";
                da = new OleDbDataAdapter(sql, cnn);
                ds = new DataSet1();
                da.Fill(ds, "ExcelData");
                CrystalReport1 Report = new CrystalReport1();
                Report.SetDataSource(ds);
                crystalReportViewer1.ReportSource = Report;

Open in new window

0
Comment
Question by:eghanem
1 Comment
 
LVL 9

Accepted Solution

by:
kprestage earned 2000 total points
ID: 24127691
Try

"'*'" + "+cstr(OrderNumber)+" + "'*'"
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
After seeing numerous questions for Dynamic Data Validation I notice that most have used Visual Basic to solve the problem. This suggestion is purely formula based and can be used in multiple rows.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question