"Mark Rae" <ma**@markNOSPAMrae.comwrote in message
news:e2**************@TK2MSFTNGP06.phx.gbl...
"tshad" <t@home.comwrote in message
news:ez**************@TK2MSFTNGP02.phx.gbl...
>"Mark Rae" <ma**@markNOSPAMrae.comwrote in message
news:uR**************@TK2MSFTNGP02.phx.gbl...
>>"tshad" <t@home.comwrote in message
news:uC*************@TK2MSFTNGP05.phx.gbl...
What am I missing?
FWIW, I *never* do this in the database layer... I always return the raw
data from SQL Server, and then format it the way I want it in the
presentation layer...
I would agree with you here but this is a report I am reading in and
formating using the DataAdapter in 5 different summary reports. I pass
the datatable to one buildCSV function that just takes the table and puts
quotes and commas around the fields (regardless to what they are). I
don't want to put the formatting for each table in the BuildCSV file. It
is easier to use Sql To do this.
But I need the convert function or something like it to convert it to
fixed sizes and to build things such as zero filled fields.
OK, let's back up a bit...
You mention Sql Stored procedures which leads me to think you are using
Microsoft SQL Server, but you are using OleDb... is that correct...? If
so, why are you not using the native .NET SQL Server data provider...?
Yes, sort of.
I am using Sql for most of my stuff. But in this case, I am reading in a
file from a .CSV file which happens to be a report. I then read this into a
DataSet. I then create about 5 reports all sorting and grouping to get the
different reports the client needs. I don't hit Sql at all here.
What I was saying about stored procedures was that in my other projects and
web pages this is how I always format my dates -
"Convert(varchar,getchar(),1)".
This is just a project I am working on currently that doesn't need Sql
Server but does need to do selects, sorts, grouping etc.
I was normally just taking the data from the report and writing it out to a
..csv file and had no problem there.
But this last report I need to create a fixed formatted line where the data
is just jammed next to each other. For example:
PR031507THIS IS A COMMENT 10850000000000000-1523
So I was using the - Convert(varchar,getchar(),1) - to get the date, and -
right("0000000000"+convert(varchar,amt),10) - to get the amount but left
fill with zeros and the length needs to be 10.
But if ADO.Net can't do this than I need to do it some other way. This
works fine in Sql Server.
Are you saying I can change it from OleDb.OleDbDataAdapter to SqlDb and that
would solve the problem?
I use the following connection strings:
Dim ConStr As String = _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
path & ";Extended Properties=""Text;HDR=No;FMT=Delimited\"""
Dim conn As New OleDb.OleDbConnection(ConStr)
Can I use the above with SqlClient to do the .csv reads?
Thanks,
Tom