Quantcast
Channel: Forum SQL Server Database Engine
Viewing all articles
Browse latest Browse all 15889

problem with bulkcopy .mdb access file into sqlserver2008

$
0
0

hi...

here is my code.i have to bulkcopy access .mdb into sqldatabase. my data is persian.when i test this code in my computer it works fine. but when i do this in server(on the web) it works good but al my data format damaged like as "ÝæÞ ÇáÚÇÏå ÓÎÊí ÔÑÇíØãÍíØßÇÑ" ...

i can't find what this happaned.

please help me.

string s = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+Server.MapPath("~/.../" + fileName);
OleDbConnection OleDbConn = new OleDbConnection(s);

           

try
        {
            string sSQLTable = table;

            string myAccessDataQuery = "Select * from " + sSQLTable;

            OleDbCommand OleDbCmd = new OleDbCommand(myAccessDataQuery, OleDbConn);
            OleDbConn.Open();


            OleDbDataReader dr = OleDbCmd.ExecuteReader();
            SqlBulkCopy bulkCopy = 
                new        SqlBulkCopy(WebConfigurationManager.ConnectionStrings["mySqlConnectionStr"].ToString() ,
                    SqlBulkCopyOptions.KeepIdentity);

            bulkCopy.DestinationTableName = sSQLTable;

            bulkCopy.WriteToServer(dr);

            OleDbConn.Close();
            return "Done";
        }


Viewing all articles
Browse latest Browse all 15889

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>