473,772 Members | 3,712 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

1 New Member
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.CommandT ext = "INSERT INTO "table name"(p1 p2 p3 p4 p5....)"
+ "VALUES(:p1 , :p2, :p3, :p4, :p5, :p6, :p7, :p8, :p9, :p10, :p11, :p12, :p13);";

............... ............... ....
PGComm.Paramete rs.Add("p7", NpgsqlTypes.Npg sqlDbType.Integ er);
PGComm.Paramete rs.Add("p8", NpgsqlTypes.Npg sqlDbType.Varch ar, 1);
PGComm.Paramete rs.Add("p9", NpgsqlTypes.Npg sqlDbType.Varch ar, 1);
PGComm.Paramete rs.Add("p10",Np gsqlTypes.Npgsq lDbType.Timesta mp);
PGComm.Paramete rs.Add("p11",Np gsqlTypes.Npgsq lDbType.Varchar , 50);
PGComm.Paramete rs.Add("p12",Np gsqlTypes.Npgsq lDbType. ????? );

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

PGComm.ExecuteN onQuery();
}

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,
Roberto
Dec 21 '07 #1
0 3057

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

Similar topics

3
11763
by: dave | last post by:
Hello there, I am at my wit's end ! I have used the following script succesfully to upload an image to my web space. But what I really want to be able to do is to update an existing record in a table in MySQL with the path & filename to the image. I have successfully uploaded and performed an update query on the database, but the problem I have is I cannot retain the primary key field in a variable which is then used in a SQL update...
7
1754
by: Tom | last post by:
hello friends I want to specify a field to save icons I want to give this field a maximum of 120kb for each icon to be stored in the db. what datatype should I assign to this field and how do I specify the size ? Thanks Tom
1
4412
by: John Scott | last post by:
I am storing an image in an SQL database and have one field as an image datatype. I am also using a webservice to transport data. I want to be able to resize the image and pass back a thumbnail image in a byte of what is in the database. I also want to be able to display this image in an <asp:image></asp:image> control. Is there any way to do this? Most of the examples that I've seen have used
2
2699
by: J Sahoo | last post by:
Hi, I have a browse page where I am showing few fields from my SQL Server table. One of the field is Image type, all the fields are bound to a single table. I want to show the image from the table on this browse along with the other fields. Here is the code what I have from the HTML view, I am using a datagrid to show the result. It does not show the image rather it shows "System.Byte " on the output. I did not have any code behind...
15
5363
by: David Lozzi | last post by:
Howdy, I have a function that uploads an image and that works great. I love ..Nets built in upload, so much easier than 3rd party uploaders! Now I am making a public function that will take the path of the uploaded image, and resize it with the provided dimensions. My function is below. The current function is returning an error when run from the upload function: A generic error occurred in GDI+. Not sure what exactly that means. From what...
2
2295
by: Bob | last post by:
I looked at the sample in the msdn january 2005 - Introducing a new datagrid, but the project downloaded failed to open. Any one can point me to a bit of code on how to go and select an image that will get put in the datagridview. The column is bound to a sql server 2005 image data field. I just need to know how to put the image in the column. Any help appreciated. Bob
3
4144
by: yefei | last post by:
I need to display images in a SQL database using a gridview I search some examples, what they did is very simple add an image field, then set the folowing properties <asp:imagefield dataimageurlfield="LastName" dataimageurlformatstring="~\Images\{0}.jpg" alternatetext="Employee Photo" nulldisplaytext="No image on file." headertext="Photo" readonly="true"/>
2
1426
by: geronimi | last post by:
Vb stores an image (bitmap/jpg) in a SQL2000 image field. For some reason it doubles the size by adding 00 for each byte. But sometimes it doesn't add 00 (0000.0000) but 01 or 20 or ?? and also the byte that should be transferd is changed... So SQLImageData = Imagebyte + 00 and sometimes SQLImageData = CHANGEDImagebyte + xx. Some example data: (hex notation):
2
5307
by: orange123 | last post by:
Hi Can someone help me please? (I am doing all this code in VB.NET) I have been trying to convert an existing document (word, excel, pdf, powerpoint, etc) to an image field) in my sql server database. I then need to be able to pull out the data from the image field and open the document. So far I have the following code:
0
9620
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10261
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10104
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8934
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6715
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2850
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.