Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
DataView/DataSet/DataReader
Message
From
08/01/2007 04:44:27
Dorin Vasilescu
ALL Trans Romania
Arad, Romania
 
 
To
08/01/2007 01:42:42
General information
Forum:
ASP.NET
Category:
ADO.NET
Miscellaneous
Thread ID:
01183234
Message ID:
01183376
Views:
34
>>
>>I would go with a DataReader and parametrized insert command.
>
>Hello Dorin.
>This is what I'm doing.

Hi
I'm an absolute beginner in NET, the only project I've done was this SqlServer CE/VFP,Sql Server Express test, to see if SSCE is good to be used as local data engine. So bear with me :)

What I've done was using parameters, see below, not tested:
.
.
.
        string lcStr1;
        string lcStr2;
        string lcStr3;
        double lnAmt;
        OleDbConnection concxn = new OleDbConnection(strConn);
        concxn.Open();

        OleDbCommand cmd = new OleDbCommand(strQuery, concxn);

        OleDbCommand cmdInsert = new OleDbCommand("insert into MyTarget (cust_id, Company, country, orderamt) values ( ?,?,?,? )", concxn);
	cmdInsert.Parameters.Add("customer_id", OleDbType.Integer,0);
	cmdInsert.Parameters.Add("company", OleDbType.VarChar,30);
	cmdInsert.Parameters.Add("country", OleDbType.VarChar,30);
	cmdInsert.Parameters.Add("orderamt", OleDbType.Numeric,0);
	cmdInsert.Prepare();

        OleDbDataReader readr = cmd.ExecuteReader();
        while (readr.Read())
        {
                cmdInsert.Parameters[0].Value = readr[0];
                cmdInsert.Parameters[1].Value = readr[1];
                cmdInsert.Parameters[2].Value = readr[2];
                cmdInsert.Parameters[3].Value = readr[3];
                cmdInsert.ExecuteNonQuery(); 
        }
.
.
.
HTH.
Previous
Reply
Map
View

Click here to load this message in the networking platform