A much more specific ASP.Net/FoxPro problem

  • Thread starter Thread starter B. Chernick
  • Start date Start date
B

B. Chernick

I'm trying to set up an ASP.Net 2.0 web app that reads some FoxPro 6 tables
that I've put in the APP_Data directory.

I've put a gridview on the first page and bound it to a sqldatasource using
an oledb provider. The connection string is "Provider=VFPOLEDB.1;Data
Source='|DataDirectory|';Collating Sequence=MACHINE" This works fine.

What I want to do next is select a record and pass its id to an editing
screen with a DetailsView. I've done dozens of these screens using
ObjectDataSources and SQL Server. OleDb seems to be different.

I bind the detailsview to another SqlDataSource, same connection string.
The query string field is passed to the screen correctly. But if I setup a
filter in the SelectQuery in a manner as similar to my normal practice as I
can manage, it crashes the page: Command contains unrecognized
phrase/keyword.

For this example, the select string is "SELECT * FROM [ord] where
[ord].jobno=@jobno" The parameter is defined as @jobno, a QueryString field.

I've tried as many variations as I can think of with this but they all end
in crashes or blank screens. If I leave out the parameter entirely, the
DetailsView does display the record normally. (Actually it's the only one in
the table at the moment.)
 
I have one question. Does foxpro recognizes paramters by its name or by its
position? I mean

Select * from ord where no = @No
OR
Select * from ord where no = ?

Some database takes second approach.

Regards
JIGNESH
 
I don't know. I'm not even sure I understand your question. (Although that
does give me something else to look for. Position. Are you refering to that
{0}, {1}, scheme used by the datasource's property?) Anyone else?

JIGNESH said:
I have one question. Does foxpro recognizes paramters by its name or by its
position? I mean

Select * from ord where no = @No
OR
Select * from ord where no = ?

Some database takes second approach.

Regards
JIGNESH


B. Chernick said:
I'm trying to set up an ASP.Net 2.0 web app that reads some FoxPro 6 tables
that I've put in the APP_Data directory.

I've put a gridview on the first page and bound it to a sqldatasource using
an oledb provider. The connection string is "Provider=VFPOLEDB.1;Data
Source='|DataDirectory|';Collating Sequence=MACHINE" This works fine.

What I want to do next is select a record and pass its id to an editing
screen with a DetailsView. I've done dozens of these screens using
ObjectDataSources and SQL Server. OleDb seems to be different.

I bind the detailsview to another SqlDataSource, same connection string.
The query string field is passed to the screen correctly. But if I setup a
filter in the SelectQuery in a manner as similar to my normal practice as I
can manage, it crashes the page: Command contains unrecognized
phrase/keyword.

For this example, the select string is "SELECT * FROM [ord] where
[ord].jobno=@jobno" The parameter is defined as @jobno, a QueryString field.

I've tried as many variations as I can think of with this but they all end
in crashes or blank screens. If I leave out the parameter entirely, the
DetailsView does display the record normally. (Actually it's the only one in
the table at the moment.)
 
I've just made some progress thanks to your suggestion, although I am still
not sure I fully understand.

In the xsd table I changed the Where clause of the parameterized query to
'WHERE (jobno = ?)'. I then went into the Parameters collection of the
Query properties and changed the parameter's name from @jobno to jobno.
(Apparently, unlike my SQL app, this one does not like @s.)

The selection in the DetailsView screen works.

(Now to figure out how to do updates.)

JIGNESH said:
I have one question. Does foxpro recognizes paramters by its name or by its
position? I mean

Select * from ord where no = @No
OR
Select * from ord where no = ?

Some database takes second approach.

Regards
JIGNESH


B. Chernick said:
I'm trying to set up an ASP.Net 2.0 web app that reads some FoxPro 6 tables
that I've put in the APP_Data directory.

I've put a gridview on the first page and bound it to a sqldatasource using
an oledb provider. The connection string is "Provider=VFPOLEDB.1;Data
Source='|DataDirectory|';Collating Sequence=MACHINE" This works fine.

What I want to do next is select a record and pass its id to an editing
screen with a DetailsView. I've done dozens of these screens using
ObjectDataSources and SQL Server. OleDb seems to be different.

I bind the detailsview to another SqlDataSource, same connection string.
The query string field is passed to the screen correctly. But if I setup a
filter in the SelectQuery in a manner as similar to my normal practice as I
can manage, it crashes the page: Command contains unrecognized
phrase/keyword.

For this example, the select string is "SELECT * FROM [ord] where
[ord].jobno=@jobno" The parameter is defined as @jobno, a QueryString field.

I've tried as many variations as I can think of with this but they all end
in crashes or blank screens. If I leave out the parameter entirely, the
DetailsView does display the record normally. (Actually it's the only one in
the table at the moment.)
 
You have understood it right.

A breif description I have given here.

Positional and Named SQL Parameters
http://dotnetjini.jigneshdesai.com/Blogs/default.aspx?MNo=1&YNo=2008

Regards

B. Chernick said:
I've just made some progress thanks to your suggestion, although I am still
not sure I fully understand.

In the xsd table I changed the Where clause of the parameterized query to
'WHERE (jobno = ?)'. I then went into the Parameters collection of the
Query properties and changed the parameter's name from @jobno to jobno.
(Apparently, unlike my SQL app, this one does not like @s.)

The selection in the DetailsView screen works.

(Now to figure out how to do updates.)

JIGNESH said:
I have one question. Does foxpro recognizes paramters by its name or by its
position? I mean

Select * from ord where no = @No
OR
Select * from ord where no = ?

Some database takes second approach.

Regards
JIGNESH


B. Chernick said:
I'm trying to set up an ASP.Net 2.0 web app that reads some FoxPro 6 tables
that I've put in the APP_Data directory.

I've put a gridview on the first page and bound it to a sqldatasource using
an oledb provider. The connection string is "Provider=VFPOLEDB.1;Data
Source='|DataDirectory|';Collating Sequence=MACHINE" This works fine.

What I want to do next is select a record and pass its id to an editing
screen with a DetailsView. I've done dozens of these screens using
ObjectDataSources and SQL Server. OleDb seems to be different.

I bind the detailsview to another SqlDataSource, same connection string.
The query string field is passed to the screen correctly. But if I setup a
filter in the SelectQuery in a manner as similar to my normal practice as I
can manage, it crashes the page: Command contains unrecognized
phrase/keyword.

For this example, the select string is "SELECT * FROM [ord] where
[ord].jobno=@jobno" The parameter is defined as @jobno, a QueryString field.

I've tried as many variations as I can think of with this but they all end
in crashes or blank screens. If I leave out the parameter entirely, the
DetailsView does display the record normally. (Actually it's the only one in
the table at the moment.)
 
Back
Top