Re: OleDbCommandBuilder Problem with views in SQL Express 2005



Try using SqlCommandBuilder/SqlDataAdapter (SqlClient) instead of
OleDb and see if that solves the problem. SqlClient is specifically
tailored for SQL Server/SQL Express.

--Mary

On Thu, 15 May 2008 08:23:02 -0700, A7mad
<A7mad@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:

Hi all,

I'm using OleDbCommandBuilder to build commands for an OleDbDataAdapter
automatically

The problem is when using OleDbDataAdapter to retrieve data from a "View" in
a SQL Express database
Ex: OleDbDataAdapter("select * from ViewName", ConnectionString);

The generated CommandText for generated commands is invalid, it looks like
this:
InsertCommand ex: INSERT INTO
D:\\FOLDER_NAME\\DATABASE_FILE_NAME.MDF.dbo.TableName
DeleteCommand ex: DELETE FROM
D:\\FOLDER_NAME\\DATABASE_FILE_NAME.MDF.dbo.TableName
UpdateCommand ex: UPDATE D:\\FOLDER_NAME\\DATABASE_FILE_NAME.MDF.dbo.TableName

Where TableName is the source table of the "View" !!!

Ofcource executing command causes an error of "Incorrect syntax near 'D:'"

Notice that, this problem doesn't occur with tables, only with views !!

Please help
.