parameter error in microsoft SQL connection with unity3d

Hi Unity Members,

In my project I am trying to create sqlClass to connect Microsoft sql server.

I have develop my class to some extend. For example, I can query data according to input of textbox. However, I am doning this query without using any paramater because it gives error.
Part of my code–>

public class SqlClass{
string connectionString = "Data Source=localhost\\SQLEXPRESS;Initial Catalog=EPTT;User ID=eptt; Password=123; Trusted_Connection=False; ";
SqlConnection cnn = new SqlConnection();
public SqlClass()
{
    cnn.ConnectionString = connectionString;
}

public DataTable Fill(string sql, params SqlParameter[] prms)
{//with parameter
    SqlCommand cmd = new SqlCommand(sql, cnn);
    if (prms != null)
    {
        cmd.Parameters.AddRange(prms);
        
    }
    SqlDataAdapter da = new SqlDataAdapter(cmd);
    DataTable dt = new DataTable();
    da.Fill(dt);
    return dt;
}

public DataTable Fill(string sql)
{//without parameter
    SqlCommand cmd= new SqlCommand(sql,cnn);
    SqlDataAdapter da= new SqlDataAdapter(cmd);
    DataTable dt= new DataTable();
    int dene=da.Fill(dt);
    return dt;
}
}

as you can see two types of my query functions. The firs one contain
cmd.Parameters.AddRange(prms); line. This line AddRange is unknown in unity (In .Net web apllication this class run without any problem). Therefore, I use Add instead of AddRange but this time it gives error “InvalidCastException:The parameter was not an SqlParameter”

could you help me, I will be glad to read your ideas.
Tnx,

Solve given problem out by how to fix sql server

Apply http://www.fixsqlserver2005.fixsqldatabase.com, item will resolve your trouble