Please can someone help me to complete this code, it was posted here but the code us not complete for me to use. I want to confirm if companyid exist in database if it does not exist display a message, data not found.. but if data exist do nothing just allow
user to continue posting. I just want to use this method to make sure that user inserts correct companyid before submitting other data.
This is the code:
protected void Button1_Click(object sender, EventArgs e)
{
using (SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["DefaultCSRConnection"].ConnectionString))
{
//Open your connection
conn.Open();
//Your Select Query
//Change this as per your design and provide the TableName and Columname here
string selectString = "SELECT COUNT(*) FROM YourTableName WHERE UserName = @UserName";
//Create Command object
SqlCommand myCommand = n ...
Go to the complete details ...