NameValueCollection nvc = new NameValueCollection();
//Fill collection
string sql="";
sql = "INSERT INTO [TABLENAME]";
//Join all keys with ],[ as seperator
sql += string.Format(" ([{0}])", string.Join("],[", nvc.AllKeys));
//Join all values with ',' as seperator
sql += string.Format(" VALUES('{0}')", string.Join("','", nvc.AllKeys.Select(key => nvc[key])));
No comments:
Post a Comment