473,767 Members | 2,198 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

load money type columns into Excel

Hi,
I am querying sql server and loading the resulting data into Excel.
For character and integer data types, it's working well, but when I pull
decimal data and attempt to load it into Excel money format it fails. Below
is a sample of the code I'm running...

Dim strRangeString As String
Dim aRange As Excel.Range
Dim decArray As Array
dim i as Integer

decArray = Array.CreateIns tance(GetType(D ecimal), 600, 6)

'data was loaded into the decarray using a sql procedure call and data reader

i = 599 ' max number of rows returned from the prodecure call

strRangeString = "i2:n" & i + 1
aRange = XL.Sheets("Aver age Loss Data").Range(st rRangeString)
aRange.Select()

'this is the line that fails
aRange.Value = decArray

'the error returned only states "The Parameter is Incorrect."

This code works for integer and character(strin g) data types. It is only
decimal that fails. The Excel file that I am attempting to load is
preformatted as a Currency type for the columns being loaded. I've also
tried changing the Excel pre-format to numeric with 2 decimal places, but I
got the same error.


Jun 27 '08 #1
1 2229
Sorry, I forgot to add that I'm using SQL Server 2005 for the database and
the incoming data is formatted as money. I tried to format the sql sat as
decimal(18,2) too, but with the same results.

Also, I'm using VB.net - VS version 7.1.3088
MS .Net Framework 1.1 version 1.1.4322

"tthrone" wrote:
Hi,
I am querying sql server and loading the resulting data into Excel.
For character and integer data types, it's working well, but when I pull
decimal data and attempt to load it into Excel money format it fails. Below
is a sample of the code I'm running...

Dim strRangeString As String
Dim aRange As Excel.Range
Dim decArray As Array
dim i as Integer

decArray = Array.CreateIns tance(GetType(D ecimal), 600, 6)

'data was loaded into the decarray using a sql procedure call and data reader

i = 599 ' max number of rows returned from the prodecure call

strRangeString = "i2:n" & i + 1
aRange = XL.Sheets("Aver age Loss Data").Range(st rRangeString)
aRange.Select()

'this is the line that fails
aRange.Value = decArray

'the error returned only states "The Parameter is Incorrect."

This code works for integer and character(strin g) data types. It is only
decimal that fails. The Excel file that I am attempting to load is
preformatted as a Currency type for the columns being loaded. I've also
tried changing the Excel pre-format to numeric with 2 decimal places, but I
got the same error.

Jun 27 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
2805
by: Stanley J Mroczek | last post by:
How do you load a dropdownlist when edit is clicked in a datagrid ? <Columns> <asp:BoundColumn DataField="OptionDescription" ItemStyle-Wrap="True" HeaderText="Option Description"></asp:BoundColumn> <asp:TemplateColumn runat="server" HeaderText="Id Type Option" "> <itemtemplate> <asp:label runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "TypeOption") %>' /> <asp:label runat="server" ID="LlbTypeOption" Visible=False...
9
21648
by: John Kirksey | last post by:
I have a page that uses an in-place editable DataGrid that supports sorting and paging. EnableViewState is turned ON. At the top of the page are several search fields that allow the user to filter the results in the grid. Say you filter the grid for records that have a certain condition set to "NO" (in this case a checkbox). In this scenario the search returns one result. If I then check the checkbox ("YES") and save it, I now get my message...
3
3342
by: Sri | last post by:
In VB, to know the field type of a column stored in a recordset the command I use is If rsQuery.Fields(k).Type = adCurrency Then How will I achieve the same in ASP.net. I could not find a currency data type in asp.net and the type is idenfied as decimal. I have two fields defined in Sql-Server, one is money and other is decimal. In asp.net both are identified as decimal.
4
5164
by: Jerry | last post by:
Is it possible to turn off the "$" and "," that appear in "money" formatted columns so I can dump the table in a numeric format? The man page hints that lc_monetary controls the formatting but I cannot find any clues on what to do... Apparently money cannot be cast to anything. I don't think it will be hard to write a custom tcl/perl script that takes a "copy checks to...." command to do the task
2
2359
by: jason.teen | last post by:
Hi, I am having trouble importing a spreadsheet from Excel into an Access Database. I have noticed that even specifying the Cell Type of the Excel Data Cell, When I import it, still get Import Errors. Like Type Mismatch. The funny thing is that its all done automatically via the Wizard, so I dont even specify what the field type should be in my database, but it
5
9955
by: Lara1 | last post by:
Hi, I'm a total beginner to VBA, so please bear with me if I seem a bit dense. What I'm Trying to Achieve I'm trying to write a procedure in Excel, which is supposed to - look at the pH values stored in column E, row by row - compare this to a threshold value of 5 - enter a string ("pH range C") in column K, if the value in column E exceeds 5.
0
3000
by: JFKJr | last post by:
I have an excel file, which has columns C and D grouped together, I am trying to delete blank columns and rows from the excel file, ungroup the columns and import the file to MS Access using Access VBA code. The following is the Access VBA code I used to delete blank columns and rows in the excel file. But, unfortunately, the resultant excel file still has two columns (C and D) grouped together, so when I am importing the file to MS Access,...
3
20843
by: Will | last post by:
Can someone help with code to delete multiple columns from an excel spreadsheet? I know which columns I need to delete. The code below will delete a single column but I'm not sure how to delete multiple columns. I'm tried experimenting with Dim rg As Excel.Range = xlSheet.Columns("B, D, G, K, L") but no joy. Thanks in advance Dim xlApp As Excel.Application Dim xlBook As Excel.Workbook Dim xlSheet As Excel.Worksheet
4
8418
hemantbasva
by: hemantbasva | last post by:
We have designed an aspx page having five ajax tab in it. the data of first four are designed on page whereas for the fifth tab it renders a user control named MYDOMAIN. in the tab container's even onactivetabindexchanged we have called a method loadtabpanel() which is defined in javascript in same page.the problem is it sometime give the message load tab panel undefined. this error does not come regularly. it comes in usercontrol rendering . i...
0
9404
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10009
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8835
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7381
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6651
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5279
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3929
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.