Želim da ispišem podatke iz tabele... Pokušala sam ovako ali neće da radi..
Da li ima neko ideju? Hvala unaprijed..
Code:
SqlConnection con = new SqlConnection(connstring);
SqlCommand com;
try
{
com = new SqlCommand();
com.Connection = con;
com.CommandText = "select * from table_name";
con.Open();
SqlDataReader reader = com.ExecuteReader();
if (reader.HasRows)
{
DataTable dt = new DataTable();
dt.Load(reader);
dataGridView1.DataSource = dt;
}
}
finally
{
con.Close();
}
SqlConnection con = new SqlConnection(connstring);
SqlCommand com;
try
{
com = new SqlCommand();
com.Connection = con;
com.CommandText = "select * from table_name";
con.Open();
SqlDataReader reader = com.ExecuteReader();
if (reader.HasRows)
{
DataTable dt = new DataTable();
dt.Load(reader);
dataGridView1.DataSource = dt;
}
}
finally
{
con.Close();
}
Da li ima neko ideju? Hvala unaprijed..
Potpis
Follow your dreams, they know the way...