How can we help you today?
c#.net Input Byte[] into image
2 CommentsSorted by Popular
What you need to be sure when passing data into an INSERT command (or really any case you're passing data to a SQL statement) is that you use parameters. This preserves the .NET type all the way into the database engine. We have a few examples in our documentation at:
but here's the relevant sample under Inserting Data using a Parameterized Command:
using (VistaDBConnection connection = new VistaDBConnection()) { connection.ConnectionString = @"Data Source=C:\mydatabase.vdb5"; connection.Open(); using (VistaDBCommand command = new VistaDBCommand()) { int Age = 21; command.Connection = connection; command.CommandText = "INSERT INTO MyTable (MyColumn) VALUES (@age)"; command.Parameters.Add("@age", Age); command.ExecuteNonQuery(); } }
Have you tried:
INSERT INTO transfertable (f1, f2, f3,........., imagefield) SELECT f1, f2, f3,........., imagefield FROM originaltable
sweeney, karl
I need to make the sql code in c# to execute to add a byte array as I am transferring the data from one database to another. I am able to get the data out of the first one and put all but the image(byte[]) into the second one