Popular Posts

Mar 19, 2013

Using BULK INSERT









string connString = ConfigurationManager.ConnectionStrings["db_connection_string"].ConnectionString;         SqlConnection conn = new SqlConnection(connString);
        conn.Open();
        Label1.Text = "In Try OPEn()";
       
        SqlCommand comm = new SqlCommand(@"
                                    BULK INSERT t_CWR_TEMP
                                    FROM '" + fileName + "'" +
                            @" WITH
                                    (
                                        FIELDTERMINATOR = ',',
                                        ROWTERMINATOR = '\n'
                                    )", conn);
        comm.ExecuteNonQuery();
        Label1.Text = "In Try Close";
        conn.Close();

No comments:

Post a Comment