C# .NET - Setting DataTable column type does not persist to MS Excel
Asked By David Sharp
01-Feb-10 01:56 PM
I am using the MS Jet driver 4.0 to export a .dbf file and its associated .dbt file. The problem I am having is that even after several hours of searching, the data in my columns are all "memo fields," meaning they are all strings/text. Since this is the case, I cannot add up any numeric values, as they are seen as text and will print a SUM of 0. I have tried multiple ways of setting the column type as follows, but none of them appear to have any effect on the output...they are still text values.
DataTable.Columns.Add(COL_HRS,
typeof(System.Double));
stream.DataTable.Columns.Add(COL_HRS)
, Type.GetType("System.Double"));
...etc.
Is this a problem with the MS 4.0 Jet Driver? Has anyone else ran into this? Thanks in advance.
Microsoft dBase Driver connection string
I don't have a complete sample. I dug this out of a 10 year old VB 6.0 app that worked heavily with dbf files. I use to use classic ADO with the Microsoft dbase driver. Here is the connection string:
"DBQ=" & sDBPath & ";Driver={Microsoft dBase Driver (*.dbf)};DriverId=277;FIL=dBase4.0"
This "might" work with the .NET Odbc classes and "might" work better than the Jet provider.
David Sharp replied to Robbe Morris
Robbe,
It seems reasonable that using the dBase driver has the potential to solve the problem. Currently, I'm working on using the Visual FoxPro driver to solve it also. Unfortunately, I feel like these could be work-arounds to the real problem, unless there's something I'm just missing.

how to use values from databse from making graph in vb.net windows app HI i am using visual studio 2010 and vb.net for making a windows application. i need to incorparate the graphs in the application As OleDbCommand Dim dr1 As OleDbDataReader Dim lane_supply As Integer Try cmd1 = New OleDbCommand ( "select sum(TruckCounts) from Sheet2 where OrigSt = '" + TextBox3.Text.ToUpper.Trim() + "' and OrigCity = '" + TextBox2.Text.ToUpper.Trim As OleDbCommand Dim dr2 As OleDbDataReader Dim lane_demand As Integer Try cmd2 = New OleDbCommand ( "select sum(LoadCounts) from Sheet2 where OrigSt = '" + TextBox3.Text.ToUpper.Trim() + "' and OrigCity = '" + TextBox2.Text.ToUpper.Trim As OleDbCommand Dim dr3 As OleDbDataReader Dim origin_supply As Integer Try cmd3 = New OleDbCommand ( "select sum(TruckCounts) from Sheet2 where OrigSt = '" + TextBox3.Text.ToUpper.Trim() + "' and OrigCity = '" + TextBox2.Text.ToUpper.Trim As OleDbCommand Dim dr4 As OleDbDataReader Dim origin_demand As Integer Try cmd4 = New OleDbCommand ( "select sum(LoadCounts) from Sheet2 where OrigSt = '" + TextBox3.Text.ToUpper.Trim() + "' and OrigCity = '" + TextBox2.Text.ToUpper.Trim As OleDbCommand Dim dr5 As OleDbDataReader Dim destination_supply As Integer Try cmd5 = New OleDbCommand ( "select sum(TruckCounts) from Sheet2 where DestSt = '" + TextBox7.Text.ToUpper.Trim() + "' and DestCity = '" + TextBox5.Text.ToUpper.Trim
Crystal report + datatable without database for begenner HI this is the first time that i will use crystal report , i have dont have database but just a datatable wich was created manually , how can i create a report using this datatable , if any one help me that will be great , im waiting , thanks for advance HI at the step by step Crystal Report . Generating a Strongly Typed DataSet Create a new VB.NET Project and accept the default settings. Create a new Dataset from Project - Add New Item Dialogue Box. vb.net_crystal_report_without_database_1.GIF Accept the default name DataSet1.xsd . Create a data table for DataSet1.xsd Select DataSet1.xsd from Solution Explorer and right click . Select datatable from the menu. Then you will get a datatable in the Datast . Right click the datatable and select Add-Column . vb.net_crystal_report_without_database_2.GIF Here we are making a two column Crystal
just dont show so i guess ill have to make it programatically, like with a datatable, can anyone help me please Hi In this example i m going to describe how application' ); insert into tbl_project_group values ( 2 , ' Web application' ); First of all, create a project in Microsoft Visual Studio 2005 and name it Crystal Report WithOracle . Then create a form as frmMain and this form. Add a Reference to System.Data.OracleClient . Step 1: Adding A DataSet and DataTable Add a DataSet to your Project and name it as myDataSet , as follows: add_dataset.jpg Now add a DataTable to myDataSet : add_data_table-1.jpg Now add columns to your DataTable as given below in the image. Your column name and datatype should be the same as that in your database. add_data_table-2.jpg Change the datatype of the DataTable columns as shown below: add_data_table-3.jpg Now save this DataTable as my_dt . add_data_table-4_change_name.jpg Now we have created our DataSet and DataTable . The next
Contest • Contact Us • About Us • Search • Login EggHeadCafe - A Global Community Of Programmers Millions of Microsoft technology professionals visit EggHeadCafe to learn about .NET , SQL Server , ASP.NET , WCF , LINQ , IIS , WPF , Silverlight , SharePoint , Windows Server , Windows 7 , Excel , Word , and a lot more! We have thousands of "how to" articles , code samples , and programming discussions . We also have a nice collection of free icons! Need a question answered? Microsoft technology experts who may know the answer to your question are online right now. We created, subfolders are created for different artifacts, assemblies are added, and so on. A new Visual Studio solution doesn’t take into account best practices such as a branchable folder structure 00) that will help you do just that. (Note: contest is complete and winner awarded) Microsoft MVP Summit Conference In A Nutshell Each year in late February, Microsoft MVP's who've been lucky enough to get their MVP status "renewed" for the to attend the MVP Summit conference for about a week of total immersion into everything "Microsoft" in their particular discipline. I've been to every Summit since 2005, and almost without to convert a List of a certain type to a CSV string, or to a DataTable. Here I provide four extension methods: 1) public static DataTable ToDataTable<T> (this IList<T
Pls help Crystal Reports in ASP.NET Crystal Reports is the standard reporting tool for Visual Studio .NET used to display data of presentation quality. You can display multiple-level totals since it is created in Designer interface. It is available as an integrated feature of Microsoft Visual Studio .NET, Borland Delphi, and c# Builder. Advantages of Crystal Reports Some of the major could reduce a few lines of code, and cache it to improve performance. The related .vb file, which is hidden, can be viewed using the editor's "show all files" icon another "OLE DB (ADO)" pop up. 6) In the "OLE DB (ADO)" pop up, Select "Microsoft OLE DB Provider for SQL Server" and click Next. 7) Specify the connection information. 8 Call the Databind method on the Page Load Event of the Code Behind file (.aspx.vb). Build and run your .aspx page. The output would look like this. Using a PUSH all the crystal report fields, the second contains all the functions, such as Avg, Sin, Sum etc and the third contains operators such as arithmetic, conversion and comparison operators. 3. Double one of the following formats: • PDF (Portable Document Format) • DOC (MS Word Document) • XLS (MS Excel Spreadsheet) • HTML (Hyper Text Markup Language - 3.2 or 4.0 compliant) • RTF (Rich Text