i can this with ado.net but i want to use it linqtosql
foreach (string ky in ld.Keys)
{
cmd.Parameters.AddWithValue(ky, ld[ky]);
}
public bool AccessProcess(string sp, ListDictionary ld, CommandType cmdType)
{
SqlConnection con = new SqlConnection(WebConfigurationManager.ConnectionStrings["conn"].ToString());
SqlCommand cmd = new SqlCommand(sp, con);
try
{
con.Open();
cmd.CommandType = cmdType;
foreach (string ky in ld.Keys)
{
cmd.Parameters.AddWithValue(ky, ld[ky]);
}
cmd.ExecuteNonQuery();
}
finally
{
con.Dispose();
cmd.Dispose();
}
return true;
}
}
How can i use addwithValue method in
var engCtx = new DataClasses1DataContext()
{
entity1 = ld[ky],
entity2 =ld[ky2],
// do sometihng. . .. . .
}
i need this:
foreach (string ky in ld.Keys)
{
engCtx.AddWithValue(ky, ld[ky]);
}