Insert during Select
- From: "Simone" <simondj1@xxxxxxxxx>
- Date: Thu, 17 Apr 2008 13:31:30 +0200
Hello.
Can i insert a record in a table B during reading records in a table A (Sql
Compact Edition 3.1)?
Something like this:
SqlCeConnection c=new SqlCeConnection("Data Source=\test.sdf");
SqleConnection d=new SqlCeConnection("Data Source=\test.sdf");
SqlCeCommand cmd=new SqlCeCommand(c,"SELECT * FROM TABLE A");
SqlCeCommand cmd1=new SqlCeCommand();
cmd1.Connection=d;
cmd.Connection.Open();
cmd1.Connection.Open();
SqlceDataReader dr=cmd.ExecuteReader();
while (dr.read())
{
string a=dr.GetString(0);
string b=dr.GetString(1);
cmd1.Text="INSERT INTO B VALUES('"+a+"','"+b+"')";
cmd1.ExecuteNonQuery();
}
dr.Close();
c.CLose();
d.Close();
Thanks,Simon.
.
- Follow-Ups:
- Re: Insert during Select
- From: Ginny Caughey MVP
- Re: Insert during Select
- Prev by Date: SQL Compact 3.1 corrupt database with password
- Next by Date: Re: Could not load sqlcecompact30.dll
- Previous by thread: SQL Compact 3.1 corrupt database with password
- Next by thread: Re: Insert during Select
- Index(es):
Loading