Hello guys,
I have faced this problem when try to changed my code using SQL Parameter but I found this error:
ExecuteReader: CommandText property has not been initialized
And Here is my code:
protected void Button1_Click(object sender, EventArgs e)
{
string Product_ID = txtprod_Id.Text.Replace("'", "''");
string Product_Name = txtprod_name.Text.Replace("'", "''");
string Product_Sku = txtsku.Text.Replace("'", "''");
//start input trapping
if (txtsku.Text != "")
{
lblMsg.Text = "";
try
{
SqlParameter[] SQLParams = new SqlParameter[2];
SQLParams[0] = new SqlParameter("@Product_ID", SqlDbType.VarChar, 30);
SQLParams[0].Value = Product_ID;
...
Go to the complete details ...