protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection MyConnection = new SqlConnection("Data Source=VIJAYSTIWARI\\SQLEXPRESS;Initial Catalog=earthquake;User ID=sa;Password=HereIsPwd;");
MyConnection.Open();
SqlCommand MyCommand = new SqlCommand("SELECT * FROM eq", MyConnection);
SqlDataReader mydr = MyCommand.ExecuteReader();
if (mydr.HasRows)
{
while(mydr.Read())
{
TextBox7.Text = mydr.GetString(1);
}
}
MyConnection.Close();
}
My table's name is eq
and it contains this data:
country
---------
india
japan
mexico
afghanistan
australia
hungary