SqlConnection connectionstring = connectionString.Getconnection(); SqlCommand command = new SqlCommand(); using (command = new SqlCommand("sp_Product_Name", connectionstring)//how to call stored proc with SELECT command { CommandType = CommandType.StoredProcedure }) command.Parameters.AddWithValue("@SI_no", txtSalesInvNo.Text.Trim()); command.Parameters.AddWithValue("@prod_name", data); int foundrec = Convert.ToInt32(command.ExecuteScalar()); if (foundrec == 0) { Save_SalesInvoice(); foreach (DataGridViewRow row in dgvCustProducts.Rows) { dgvCustProducts.Rows[row.Index].SetValues(false); row.Cells[1].Value = 0; } } else { MessageBox.Show("One of the Products already exist. Please Check the Records", "Duplicate Records", MessageBoxButtons.OK, MessageBoxIcon.Error); //txtSalesInvNo.Text = ""; //txtSalesInvNo.Focus(); }
CONSTRAINT
WHERE
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)