VB.Net and SQL server

abeed

New member
Joined
Feb 16, 2006
Messages
1
Programming Experience
Beginner
Hi There: Very first time in your forum. I have a VB.net project that takes data from SQL server and puts them in MS Excel as reports. The SQL stored procedure is used to generate .Net dataset. In SQl, I take data from a view where I declare all my data as integer. In SQL stored procedure , I declare them as bigint. When I am running the Stored procedure from SQL Query analyzer, I am getting the currect results. But when I am running my .net program, I am getting wrong numbers as shown in my excel sheet. I saw the dataset in .net is created where the data are declared as long. So before putting into excel sheet from vb.net the result is(say for 1 field) 103,456,566. But in Excel sheet its showing as103,456,560. So its a bit less in Excel now. I tried to change the data type in my SQL stored procedure as real, float and each time its giving me quite different results. Only declaring bigint in SQl gives me the currect result in SQL side but again wrong in Excel.
Thanks in advance
Abeed
 
How are you putting the data into Excel? Maybe if you shared some of that code, we'd be able to see what's going on.

-tg
 
I’m probably the last person who should be giving advice, but a couple years ago, I thought I read something similar to this problem. The article talked data not formatting correctly and the bottom line was it had to do with the number of things in the column.

For example, say you have a column with 4 numbers in it. During this transfer from maybe SQL to Excel, the datatype isn’t maintained because it takes at least so many records before the other program will zero in on the datatype and maintain it.

They didn’t explain it exactly like that, but that was the basic idea. I think the program wanted at least 5 records or something. I also think this was an issue moving data from Excel to Sql, not the other way around. Anyway, if you’re still having problems, maybe this would be something to look into.
 
Back
Top