[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.odbcnet

Paradox 7 through Odbc.Net

Luke Stamm

6/18/2002 9:51:00 PM

I'm accessing a Paradox 7 database through Odbc.Net. All
my Delete, and Select commands are functioning properly.
However, after inserting records and calling
Odbc.DataAdapter.Update an Odbc.OdbcException is thrown
containing the following message:

Message: [Microsoft][ODBC Paradox Driver]Invalid string or
buffer length
Native: 84
Source: odbcjt32.dll
SQL: HY090

I suspect the error might be in my INSERT statement or
perhaps DbNull values are getting passed to the driver
improperly? The general form of my INSERT statement is as
follows:

INSERT INTO Table1 ([Value One], [VALUE TWO],
[value3], ...) VALUES (?, ?, ?,...)

The table contains 28 fields, all of which I are in the
INSERT statement. Some may contain DbNull values though.

Is there any way to get the value of the CommandText after
the parameters have been set in place? Is there a problem
with my select statement? Has anyone experienced a problem
similar to this? Any feed back would be appreciated.
Thanks in advance.

Luke Stamm
Wholesale Information Network, Inc.
luke@win-world.com
2 Answers

(Hussein Abuthuraya(MSFT))

6/18/2002 11:53:00 PM

0

Luke,

To verify the Insert statement that is being sent to your database, you may do one of the following:

- Generate an ODBC trace (ODBC Administrator then click on Tracing tab and click on "start tracing now"). The trace file should capture the sent Insert statement.
- You could also get the Insert command if you add RowUpdated event to your DataAdapter and check the argument.Command.CommandText

In regard to null parameters, if you really want to send null to a parameter you should always use DbNull.Value


Thanks,
Hussein Abuthuraya
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.

Are you secure? For information about the Microsoft Strategic Technology Protection Program and to order your FREE Security Tool Kit, please visit
http://www.microsoft.co....


Luke Stamm

6/19/2002 3:06:00 AM

0

Hussein, thanks for the prompt reply.
I solved the problem.
It's always something simple...

I added an event handler for RowUpdated (and RowUpdating
for that matter) and took a gander at CommandText and, not
to my surprise, the question mark place holders for the
parameters had not been filled.

I ran a trace and here's where the learning took place.
The Command object passes the parameters to the driver
rather than substituting the place holders itself. In the
trace I learned that the parameters were successfully
passed to the driver and the INSERT command made it to the
driver, but failed there. That implied that Odbc.Net was
functioning properly, and that either the driver was
functioning properly or I had the command setup improperly.

As it turns out one of the Source Column Names in my
parameters didn't match the case of the Columns setup in
my schema (Doh!)

Hope other people can learn from my mistakes.

Thanks again.

>-----Original Message-----
>Luke,
>
>To verify the Insert statement that is being sent to your
database, you may do one of the following:
>
>- Generate an ODBC trace (ODBC Administrator then click
on Tracing tab and click on "start tracing now"). The
trace file should capture the sent Insert statement.
>- You could also get the Insert command if you add
RowUpdated event to your DataAdapter and check the
argument.Command.CommandText
>
>In regard to null parameters, if you really want to send
null to a parameter you should always use DbNull.Value
>
>
>Thanks,
>Hussein Abuthuraya
>Microsoft Developer Support
>
>This posting is provided "AS IS" with no warranties, and
confers no rights.
>
>Are you secure? For information about the Microsoft
Strategic Technology Protection Program and to order your
FREE Security Tool Kit, please visit
>http://www.microsoft.co....
>
>
>.
>