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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I Use SQL Statements in ASP(VB Script) to query from DBASE 5 Table

Status
Not open for further replies.

pengprog

Programmer
Jul 16, 2002
25
US
I am programing with ASP using the VB script language.
I am working on IIS and I need to query to a DBASE 5 table that I have.

I want to use an SQL statement to get certain records that match a specific value. Problem is I don;t know how to open the recordset.

I can open up the connection to the database ok.
I can even get all the records from the table by us using:

objRS.Open "EMPLOYEE.dbf", objConn,,,adCmdTable

but now I need to use a SQL statment. Here is my code:

Set objRS = Server.CreateObject("ADODB.Recordset")
sql = "SELECT * FROM EMPLOYEE WHERE EMPLOYEE.Id_no = " & id_num

objRS.Open sql, objConn

Thanks,
I can't seem to find info on accessing Dbase table using ASP anywhere!!!!

-Frustrated Programmer
 
insert:
objRS.CursorLocation = adUseClientbefore you open the connection. Dbase will not do its own thinking when called from VB. Hope this helps.

BKtechie
 
Still having problems

My code:

Set objRS = Server.CreateObject("ADODB.Recordset")
sql = "SELECT * FROM EMPLOYEE.dbf WHERE EMPLOYEE.Id_no = #" & id_num

objRS.CursorLocation = adUseClient
objRS.Open sql, objConn,,,adCmdTable

Error Message:
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC dBase Driver] Syntax error in FROM clause.
/intranet/bupp/find_pr_car_records.asp, line 36

Line 36 is the line witht eh swl statement. Is there something wrong with this statement. Does DBase require different SQL statments???

Thanks.


 
try killing off the .dbf on the EMPLOYEE table. BTW ever had any luck with dates in SQL to dBase? Good luck
BK
 
I have figured out my problem!

Looks like the problem was with the SQL statment.
Looks like it does not like me to use EMPLOYEE.FIELDNAME
so by just using the field name it works.

 
I have figured out my problem!

Looks like the problem was with the SQL statment.
Looks like it does not like me to use EMPLOYEE.FIELDNAME
so by just using the field name it works.

sorry have not used dates yet
 
I have figured out my problem!

Looks like the problem was with the SQL statment.
Looks like it does not like me to use EMPLOYEE.FIELDNAME
so by just using the field name it works.

sorry have not used dates yet
 
I am trying to do somewhat of the same task. However, I am unable to connect to the database. Could someone please inform me of the correct COnnection String?

This is what I have so far
"Driver={Microsoft dBASE Driver (*.dbf)};"
"DriverID=277;" & _
"Dbq=S:\Common;"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top