Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to retrive a character with select statment from excel sheet

Posted on 2009-04-12
1
Medium Priority
?
958 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 9

Accepted Solution

by:
kprestage earned 2000 total points
ID: 24127691
Try

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

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

670 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