Hi friends...
I have 2 Tables one is sql 2008 (Table_1)and one is in MS access (Table_2) .. From Table_2 [ which is in MS access has certain values ]
i have to feed those values into my Table_1[ which is in sql2008 database]... how ???
Can anyone help me please....its urgent ....
Thank u so much for spending your valuable time ....
Loading
Krishna GaradPosted May 21, 2012, 8:02 AM
Krishna GaradPosted May 22, 2012, 12:41 AM
OledbConnection acon=new OledbConnection("u r connection string here");
OledbCommand acmd=new OledbCommand("Select * From Table",acon);
OledbAdapter ada=new OledbAdapter(acmd);
DataSet ads=new DataSet();
ada.Fill(ads);
foreach(DataRow dr in ads.Tables[0].Rows)
{
int _id=Convert.ToInt32(dr["Id"].ToString());
SqlConnection cn=new SqlConnection("Sql ConnectionString Here");
SqlCommand cmd=new SqlCommand(Insert Into Table(Id)Values("+_id+"))";
cn.Open();
cmd.ExecuteNonQuery();
cn.Close();
}
sathish kumarPosted May 21, 2012, 8:08 AM
sathish kumarPosted May 21, 2012, 6:50 AM
thanks for t reply....
Krishna GaradPosted May 21, 2012, 6:05 AM
DataSet ds=GetFromAccess();
foreach(DataRow dr in ds.Tables[0].Rows)
{
//create variables for each column and acces values
int _id=Convert.ToInt32(dr["Id"].ToString());
//here insert into sql database
}