private void txtPriceGold_Enter(object sender, EventArgs e) { string connstr = @"Server=.\SQLEXPRESS ;Initial Catalog=RPSJDB;Integrated Security=True; Max Pool Size=100"; string strSql = "select txtPriceGold from PriceTable Where txtPriceGold=" + txtPriceGold.Text+ ""; SqlConnection conn = new SqlConnection(connstr); conn.Open(); SqlCommand objCommand = new SqlCommand(strSql, conn); using (SqlDataReader dr = objCommand.ExecuteReader()) { bool success = dr.Read(); if (success) { txtPriceGold.Text = dr.GetString(1);
} } conn.Close(); error is Incorrect syntax near '='.
↧