dimanche 29 mars 2015

connect to an sql server 2005 from a windows mobile

i am new to this site, hope that you won't laugh at my problem, i have a new type of project for me to build, i need to make an app for a motorola symbol mc9090 barcodescanner running windows mobile 6. i need to connect from this app to a sql server 2005 database, can i connect with an ado connection like the one below? the port is open. i use windows classic emulator for debugging but it crashes on myconn.open().


thank you very much for your answers.



SqlConnection myConn = new SqlConnection(@" Data Source=***.***.0.***,1443;Initial Catalog=test_database;User ID=****ica;Password=********;");
try
{
myConn.Open();

SqlCommand comm = new SqlCommand("select * from test_table where id = 1", myConn);

SqlDataReader reader = comm.ExecuteReader();

while (reader.Read())
{
MessageBox.Show(reader[0].ToString() + "\t" + reader[1].ToString());
}

}catch(Exception ex){MessageBox.Show(ex.Message);}
finally{ myConn.Close();}
}

Aucun commentaire:

Enregistrer un commentaire