Hi!
im getting this error. I dont know why.
PLZ can anyone help me.
this is my code
public void getLastMemID()
{
String concString = "Data Source=BJ-PC\\SQLEXPRESS;Initial Catalog=new;Integrated Security=SSPI";
// int ID=0;
try
{
CN = new SqlConnection(concString);
CN.Open();
SqlCommand com = new SqlCommand("SELECT MAX(ImageId) FROM ImagesStore", CN);
SqlDataReader dr = com.ExecuteReader();
MessageBox.Show("after com");
if (dr.HasRows)
{
MessageBox.Show("after hasrows");
while (dr.Read())
{
MessageBox.Show(dr["ImageId"].ToString());
}
}
else
{
MessageBox.Show("No rows");
}
}
catch (SqlException ex)
{
MessageBox.Show("A SqlException")
MessageBox.Show(ex.ToString());
}
finally
{
CN.Close();
}
}