Solved

How to retrive a character with select statment from excel sheet

Posted on 2009-04-12
1
949 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Problem with SqlConnection 5 121
COnsume rest client 6 15
Cells protection in Excel 7 22
Column Formatting 4 6
Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …

747 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

15 Experts available now in Live!

Get 1:1 Help Now