المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : SQL Connection Problem



C# Programming
10-28-2009, 07:50 AM
Hello

I've got a comboBox and I want to make a query after a change in the selected item is done.

Inside the "comboBox1_SelectedIndexChanged" function, I wrote these:


string ogretisim;
ogretisim = comboBox1.Text;
SqlConnection conn = null;

conn = new Sqlconnection("Data Source = Veritabani.sdf");
conn.Open()
conn.Close();

I did not do the query yet, just to try.

In the runtime, conn.Open() gives an error like it cannot reach the server.

What can be the problem?

note:

I've tried all of these:

newSqlConnection("Data Source = baglanXXX");
newSqlConnection("Data Source = Veritabani.sdf");
newSqlConnection("Data Source = .\\Veritabani.sdf");
newSqlConnection("Data Source = VeritabaniDataSet.xsd");
newSqlConnection("baglanXXX");

("baglanXXX" is my connection string)

please someone help :(