Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
Error executing asp/foxpro sql statements
Old 12-13-2005, 03:57 AM Error executing asp/foxpro sql statements
Junior Talker

Posts: 2
Trades: 0
I have a web form linked with a fox pro database. When creating the record set I am having a problem when adding a date variable to the statement in the sql where condition.

When i run the sql as below it works:

select fields
from tables
where time.true_date =CTOD('09/01/2005')

but when i create a variable to append to the sql an error is raised when running it. See sql below:

select fields
from tables
where time.true_date =CTOD(var_date)

error is : Microsoft ODBC visual fox pro driver function arguement value, type or count is invalid.

can you tell me wat is the exact syntax to append a date variable to the sql statment above for a fox pro database
ashley12 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-13-2005, 03:42 PM
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,519
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
... CTOD(" & var_date & ")"
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 12-14-2005, 01:00 AM error
Junior Talker

Posts: 2
Trades: 0
Hi,,

The code does not work... the following error occur:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC Visual FoxPro Driver]Function argument value, type, or count is invalid.
/jantest/rep_result.asp, line 32


Here is the code in asp:
--------------------------------------------------------
<%
Dim rs_result__var_branch
rs_result__var_branch = "01"
If (Request.form("sel_branch") <> "") Then
rs_result__var_branch = Request.form("sel_branch")
End If
%>
<%
Dim rs_result__var_company
rs_result__var_company = "01"
If (Request.form("sel_location") <> "") Then
rs_result__var_company = Request.form("sel_location")
End If
Dim rs_result__var_date
rs_result__var_date = "09/01/2005"
If (Request.form("txt_date") <> "") Then
rs_result__var_date = Request.form("txt_date")
End If
%>
<%
Dim rs_result
Dim rs_result_numRows
Set rs_result = Server.CreateObject("ADODB.Recordset")
rs_result.ActiveConnection = MM_ConJanweb_STRING
rs_result.Source = "SELECT emp.employeeid, lastname, firstname, in, out, dept.desc,time.true_date FROM branch, emp, time, dept, company WHERE emp.employeeid = time.employeeid and emp.branch = branch.branch and emp.dept = dept.dept and emp.company = company.company and emp.branch = " + Replace(rs_result__var_branch, "'", "''") + " and emp.company = " + Replace(rs_result__var_company, "'", "''") + " and time.true_date = ctod("+ rs_result__var_date + ") ORDER BY true_date"
rs_result.CursorType = 0
rs_result.CursorLocation = 2

--------------------------------------------------------

The code for time.true_date should be as follows when before executing the sql statement:

and time.true_date = ctod('09/01/2005') -- mm/dd/yyyy
ashley12 is offline
Reply With Quote
View Public Profile
 
Old 12-14-2005, 06:26 PM
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,519
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
response.write out the SQL string before sending the call to the DB to see if it is what you expect.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to Error executing asp/foxpro sql statements
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.37942 seconds with 12 queries