Question: I am trying to pass parameters to my stored procedure. They are like this

```
@p_latitude='',@p_longitude='',@p_miles='',@p_searchtext='',@p_maptownid=182,@p_regionid=0

```

From code I am passing the parameters like 

```
cmd.Parameters.Add("@p_latitude", SqlDbType.NVarChar).Value="''";
cmd.Parameters.Add("@p_longitude", SqlDbType.NVarChar).Value="''";
cmd.Parameters.AddWithValue("@p_miles",0);
cmd.Parameters.Add("@p_searchtext",SqlDbType.NVarChar).Value="''";
cmd.Parameters.AddWithValue("@p_maptownid",maptownid);
cmd.Parameters.AddWithValue("@p_regionid",0);

```

I'm getting an error `cannot convert navarchar to float`.
I tried in different ways sending null, string.empty. But couln't find it.

Answer: 
Empty strings should be passed as `""` not `"''"`. The apostrophes (`'`) will be passed in as the string value and not as string delimiters. 
The error message says you have a float column that you pass a nvarchar. I suspect that the @p\_latitude and @p\_longtitude params is the problem. Try to set the value directly as DBNull.Value.
Try using DbType.String instead of SqlDbType.NVarChar

Well actually, this is how I do it (they were all in different layers so I suggest you to do the same):

```
List<SqlParameter> parameters = new List<SqlParameter> { };

string status = "dummystatus";
string date = Datetime.Now;
parameters.Add(new SqlParameter("@Status", status));
parameters.Add(new SqlParameter("@date", date));

SqlCommand cmd = new SqlCommand();
command.Connection = connection;

//set the command text (stored procedure name or SQL statement)
command.CommandText = commandText;
command.CommandType = commandType;
foreach (SqlParameter p in parameters)
{
    command.Parameters.Add(p);
}
SqlDataAdapter da = new SqlDataAdapter(command);
DataSet ds = new DataSet();

//fill the DataSet using default values for DataTable names, etc.
da.Fill(ds);

// detach the SqlParameters from the command object, so they can be used again.         
cmd.Parameters.Clear();

```