ADO.NET SqlClient doesn't throw an error for a bad sql

Dumitru Sbenghe <[email protected]> Thu, 8 Aug 2002 11:54:24 +0300
Newsgroups gmane.comp.windows.devel.oledb.devel
Message-ID <[email protected]>
Hi,

I have a strange situation; I execute a create view statement which is not
OK.
The SqlClient doesn't throw the error, the Oledb ADO.NET throw the error.
Why?

string toExec = "CREATE VIEW vvv AS SELECT o.OrderID, od.OrderID From
[Orders] o join [Order Details] od ON o.OrderID = od.OrderID";

SqlConnection cn = new SqlConnection();
//OleDbConnection cn = new OleDbConnection();
cn.ConnectionString = "User ID=sa;Initial Catalog=Northwind;Data Source=Q";
//cn.ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=True;User
ID=sa;Initial Catalog=Northwind;Data Source=Q";
cn.Open();
IDbCommand cmd = cn.CreateCommand();
cmd.CommandText = toExec;
cmd.ExecuteNonQuery();
Console.WriteLine("exec \n" + toExec);

Thanks

Dumitru

You can read messages from the OLEDB_DEV archive, unsubscribe from OLEDB_DEV,
or subscribe to other DevelopMentor lists at http://discuss.develop.com.