Solved

How to retrive a character with select statment from excel sheet

Posted on 2009-04-12
1
950 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 500 total points
ID: 24127691
Try

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

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

864 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now