problem with bulkcopy .mdb access file into sqlserver2008
-
Sunday, November 18, 2012 9:33 AM
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";
}
All Replies
-
Sunday, November 18, 2012 10:05 AMAnswerer
What is about data types in SQL Server, has the field defined as NVARCHAR(n)? Make sure that Persian font is installed on the server tooBest Regards,Uri Dimant SQL Server MVP, http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Blog: Large scale of database and data cleansing
MS SQL Consultants: Improves MS SQL Database Performance
- Marked As Answer by Allen Li - MSFTModerator Monday, November 26, 2012 2:24 AM
-
Sunday, November 18, 2012 1:08 PM
Hello,
Maybe a thread related to
I think that this thread should be moved in the
http://social.msdn.microsoft.com/Forums/en-US/sqldataaccess/threads
where this kind of problems is usually treated
Have a nice day
Mark Post as helpful if it provides any help.Otherwise,leave it as it is.

