Hi all
I need to help to convert sql query to stored procedure .
I have page that has differenet option below image .when we check those option we get the data .

Here is my sql string in .net i want to convert into stroed procedure so that i can improve perfomance .
string sqlString = "SELECT DISTINCT nvg.ltypeid, SLenses.DESCRIPTION as 'Product Name', SLenses.TYPE, SLenses.WEBPRICE,SLenses.NewProductInd FROM nvg JOIN SLenses ON nvg.pid = SLenses.pid LEFT OUTER JOIN nvgo on nvgo.pid=SLenses.pid ";
if (type != "")
{
sqlString = sqlString + "WHERE SLenses.TYPE IN (" + type + ")";
}
if (lens != "" && type != "")
{
sqlString = sqlString + " AND SLenses.MATERIAL IN (" + lens + ")";
}
else if (lens != "")
{
sqlString = sqlString + "WHERE SLenses.MATERIAL IN (" + lens + ")";
}
if (option != "" && (lens != "" || type != ""))
{
sqlString = sqlString + " AND nvgo.[OPTIONS] IN (" + option + ")";
}
else if (option != "")
{
sqlString = sqlString + "WHERE nvgo.[OPTIONS] IN (" + option + ")";
}
if (brand != "" && (option != "" || lens != "" || type != ""))
{
sqlString = sqlString + " AND nvg.manid IN (" + brand + ")";
}
else if (brand != "")
{
sqlString = sqlString + "WHERE nvg.manid IN (" + brand + ")";
}
Thank you Guys.