Click here to Skip to main content
15,912,205 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hey guys um sending a data list(type of class employee) for a wcf service which includes an int , string ,string .

i want to send that values to a sql database , so how can i extract those values from the list and send it to the db
thanks

p.s um a newb :D
Posted

1 solution

hey ,
nvm i figured it on my own
my code is
C#
foreach (var sqllist in list)
            {

                emp2.id = sqllist.id;
                emp2.fname = sqllist.fname;
                emp2.sname = sqllist.sname;
                string qry = string.Format("INSERT INTO test_tbl(id, fname, sname) VALUES('" + @emp2.id +"','"+@emp2.fname+"','"+@emp2.sname+ "')");

                SqlCommand com = new SqlCommand(qry, con);
                com.ExecuteNonQuery();
            }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900