How to add values listDictonary to sql with linqtosql?

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]);
}

Answers


GetCommand?

http://msdn.microsoft.com/en-us/library/system.data.linq.datacontext.getcommand.aspx


Need Your Help

Minimal example of TAILQ usage out of <sys/queue.h> library

c linux gcc queue

Can some one provide minimal example of TAILQ usage out of linux system library with explanation in c which can be compiled using gcc in Linux?

Yii2 and Google maps API

javascript php css google-maps yii2

I have an empty Yii2 project. I need set up Google Map to specified page. I know that I have to include my .js and .css files but I don't know how exactly. I tried to set up my scripts here in assets/