|
|
#1 |
|
Hyperactive Member
Join Date: Aug 09
Location: Los Angeles
Posts: 482
![]() |
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 Last edited by billboy; Nov 28th, 2009 at 01:55 PM. Reason: wrong forum |
|
|
|
|
|
#2 |
|
Fanatic Member
Join Date: May 06
Location: the edge
Posts: 724
![]() |
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] |
|
|
|
|
|
#3 | |
|
Hyperactive Member
Join Date: Aug 09
Location: Los Angeles
Posts: 482
![]() |
Re: Select All Fileds and Cdbl for One
Quote:
getting syntax error any ideas? |
|
|
|
|
|
|
#4 |
|
Fanatic Member
Join Date: May 06
Location: the edge
Posts: 724
![]() |
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 |
|
|
|
![]() |
|
||||||
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|