try
{
string conString="Data Source=Computer_name;packet size=4096;Integrated Security=true;initial catalog=DataBase_name";
SqlConnection myConnection = new SqlConnection();
myConnection.ConnectionString=conString;
SqlCommand myCommand=new SqlCommand();
myCommand.Connection=myConnection;
myConnection.Open();
myCommand.CommandText="SELECT fild_name FROM mytable ";
myCommand.ExecuteNonQuery();
SqlDataReader myReader=myCommand.ExecuteReader();
while(myReader.Read())
{
this.textbox1=myReader.Getstring(0);
}
myReader.Close();
myConnection.Close();
}
catch
{
if(this.language_name=="farsi")
{
MessageBox.Show("ارتباط با فایل ذخیره اطلاعات بارنامه ها مشکل دارد","خطا در ارتباط با پایگاه داده");
}
else
{
MessageBox.Show("An error occurred accessing the database !","Conn't Connection to Database !");
}
}