[RESOLVED] Select All Fileds and Cdbl for One
I am using the following code to get all my database fields, I would like to convert one of the fields to Cdbl, not sure how to do that
Dim comm As New OleDb.OleDbCommand("Select * From " & Me.OpenFileDialog1.SafeFileName & " Where Status <> 'S'", con)
I know how to individually do it field by field but i dont want to have to write a select for each field if that makes sense?
Dim comm2 As New OleDbCommand("Select Cdbl([Selling Price]) as SoldPrice, Status From " & Me.OpenFileDialog1.SafeFileName & " Where Status = 'S'", con)
So something that pulls ALL fields and converts one
sorry posted in wrong section, reposted in database development
Re: Select All Fileds and Cdbl for One
You can do it in SQL Server (never try using Access)
With the next query you'll obtain all the fields plus a new one named NewPrice at the end of all the existing fields
Remember to change the function Convert if you use other db instead of sql server
Code:
SELECT *, Convert(float,[Price]) As NewPrice
FROM [Report].[dbo].[Invoices]
Re: Select All Fileds and Cdbl for One
Quote:
Originally Posted by
jggtz
You can do it in SQL Server (never try using Access)
With the next query you'll obtain all the fields plus a new one named NewPrice at the end of all the existing fields
Remember to change the function Convert if you use other db instead of sql server
Code:
SELECT *, Convert(float,[Price]) As NewPrice
FROM [Report].[dbo].[Invoices]
Dim comm As New OleDb.OleDbCommand("Select * , Cdbl([Listing Price]) as ListPrice, From " & Me.OpenFileDialog1.SafeFileName & " Where Status <> 'S'", con)
getting syntax error
any ideas?
Re: [RESOLVED] Select All Fileds and Cdbl for One
What do you have in ---Me.OpenFileDialog1.SafeFileName ---?
I think that FROM clause needs a tablename and not a filename