hi m getting the following exception:System.Data.SqlClient.SqlException: Incorrect syntax near '4'.
the following is what i was trying:
public void hostel_cpacity(ManageHostelRoomsBE hmr)
{
string str;
string conString = System.Configuration.ConfigurationManager.ConnectionStrings["Hosteluog"].ConnectionString;
SqlConnection con = new SqlConnection(conString);
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;
con.Open();
DataTable dt = new DataTable();
DataTable dt1 = new DataTable();
SqlDataAdapter da = new SqlDataAdapter();
str = "select HostleName from tbl_Hostel where (HostelID ='" + hmr.HostelID + "')";
cmd.CommandText = "insert into hostel_info(hostelName,rooms,capacity) values ('" + str + "','" + hmr.RoomNO + "','" + hmr.CapacityID + "')";
cmd.ExecuteNonQuery();
con.Close();
}
plz help me in this regard.