Log in

View Full Version : Help needed !. Sql exception


raghuraman_ace
07-04-2005, 07:41 PM
Hi,
am developing PPC windows app.I created the database in sqlce as follows .If i check the availablity of the database ,it says ,it is available.But if i open the connection,It tells the error
-----
An unhandled exception of type 'System.Data.SqlServerCe.SqlCeException' occurred in System.Data.SqlServerCe.dll
-----------

Code:

-----------------
DataSet ds=new DataSet("gr");
SqlCeConnection con=null;
SqlCeEngine Db;
string SqlCeConnString="";
-------------------------------------------
button1 click()
{
SqlCeConnString=@"\My Documents\Ace.sdf";
if(File.Exists(SqlCeConnString))
File.Delete(SqlCeConnString);
SqlCeConnString="Data Source=" + @"My Documents\Ace.sdf";
Db=new SqlCeEngine();Db.LocalConnectionString=SqlCeConnString;
Db.CreateDatabase();
} //Database created.Ok
------------------------------------------------------------
button2 click()
{
ds=new DataSet();
if(File.Exists(@"\My Documents\Ace.sdf"))
MessageBox.Show("hi"); // oK Available displayed
SqlCeConnString ="Data Source=" + @"My Documents\Ace.sdf";
con=new SqlCeConnection(SqlCeConnString);
con.Open(); -----------------------Error
}
If i print the error description,There is no content,just blank box is displayed.

Please tell me where i gone wrong.
Thanks & Regards
Raghu

raghuraman_ace
07-06-2005, 05:28 AM
Hi i found the solution.

It is of course nothing but i need not open the connection again.I worked out.


Thanks
Raghu