// them bill public object insertBill(string date, int totalprice) { string query = "insert into Bill(Date, TotalPrice) values (@date, @totalprice); select SCOPE_IDENTITY() "; object[] value = new object[] { date, totalprice }; DBConnect db = new DBConnect(); //_id = (int)(db.ExecuteScalar(query, value)); _id = Int32.Parse(db.ExecuteScalar(query, value).ToString()); return(_id); //return (db.ExecuteNonQuery(query, value) > 0); }