By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,515 Members | 1,363 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,515 IT Pros & Developers. It's quick & easy.

Image field in SQL Server 2005 to lo field in PostGres 8.2

P: 1
Hi! I'm an Italian user of PostGres and I'm having some trouble! I hope you can help me!
I'm trying to migrate the db content from SQL SERVER 2005 to PostGreSQL. Everything works ok except for the "image" fields. I have this code:

PGComm.CommandText = "INSERT INTO "table name"(p1 p2 p3 p4 p5....)"
+ "VALUES(:p1 , :p2, :p3, :p4, :p5, :p6, :p7, :p8, :p9, :p10, :p11, :p12, :p13);";

PGComm.Parameters.Add("p7", NpgsqlTypes.NpgsqlDbType.Integer);
PGComm.Parameters.Add("p8", NpgsqlTypes.NpgsqlDbType.Varchar, 1);
PGComm.Parameters.Add("p9", NpgsqlTypes.NpgsqlDbType.Varchar, 1);
PGComm.Parameters.Add("p10",NpgsqlTypes.NpgsqlDbTy pe.Timestamp);
PGComm.Parameters.Add("p11",NpgsqlTypes.NpgsqlDbTy pe.Varchar, 50);
PGComm.Parameters.Add("p12",NpgsqlTypes.NpgsqlDbTy pe. ????? );

foreach (DataRow dr in dataTable.Rows)
PGComm.Parameters[7].Value = dr[7];
PGComm.Parameters[8].Value = dr[8];
PGComm.Parameters[9].Value = dr[9];
PGComm.Parameters[10].Value = dr[10];
PGComm.Parameters[11].Value = dr[11];
PGComm.Parameters[12].Value = dr[12];


Now, the problem is: as long as I have to deal with Integer and VarChar, everything works fine. But for a field which in the SQL table is of type "image", which type I have to pass as a parameter? lo is not present in NpgsqlDbType, and if I use Bytea everything freezes when I launch the command.

Where am I wrong? I hope someone could help! Thanks in advance,
Dec 21 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.