Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Convert function and odbc vs sql

Status
Not open for further replies.

jeffmoore

Programmer
Aug 29, 2003
301
US
The problem here is that the convert function below gives me an error in the ODBC data string. The SQL string works fine!!!
Here is the error message I get at execution on console:

error: ERROR [42000] [Microsoft][ODBC Text Driver] Undefined function 'convert' in expression.

CONVERT(varchar(8), fld_time, 8)

Dim MyDataAdaptor As New System.data.sqlclient.SqlDataAdapter("select fld_date, CONVERT(varchar(8), oldtime, 8)as fld_time, fld_od, fld_max, fld_min, fld_ovality from tbl_data_laser_1", connect)

MyDataAdaptor = New System.data.Odbc.OdbcDataAdapter("select fld_date,CONVERT(varchar(8), oldtime, 8) as fld_time, fld_od, fld_max, fld_min, fld_ovality from [" + strFilename + "]", connect)


Any ideas?
BTW, If I drop the convert function from the ODBC string It works just fine .... but my data (time) is shown as a date, hence the need to convert it. I have tried thr format function but couldn't get it to work

TIA
jeff
 
Thanks ... the problem here is that i'm pulling data in from a text file ... adding some data to to it and pushing it out to a sql server.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top