Help with inserting bytea
Posted: Tue 23 Nov 2004 19:40
I have a string which I want to INSERT into a bytea field. I dont know how to convert the string into to correct format:
I tried this“but it does not work (column "content" is of type bytea but expression is of type integer)
com.CommandText = "INSERT INTO test (partner_id,autor_id,title,content) VALUES (@1,@2,@3,@4)"
com.Parameters.Add("@1", CoreLab.PostgreSql.PgSqlType.Int)
com.Parameters.Add("@2", CoreLab.PostgreSql.PgSqlType.Int)
com.Parameters.Add("@3", CoreLab.PostgreSql.PgSqlType.VarChar)
com.Parameters.Add("@4", CoreLab.PostgreSql.PgSqlType.ByteA)
dim b as byte()
b = Convert.FromBase64String("test")
com.Parameters("@1").Value = partner_id
com.Parameters("@2").Value = autoren_id
com.Parameters("@3").Value = titel
com.Parameters("@4").Value = b
com.Connection = dh.GetConnection()
com.ExecuteNonQuery()
I tried this“but it does not work (column "content" is of type bytea but expression is of type integer)
com.CommandText = "INSERT INTO test (partner_id,autor_id,title,content) VALUES (@1,@2,@3,@4)"
com.Parameters.Add("@1", CoreLab.PostgreSql.PgSqlType.Int)
com.Parameters.Add("@2", CoreLab.PostgreSql.PgSqlType.Int)
com.Parameters.Add("@3", CoreLab.PostgreSql.PgSqlType.VarChar)
com.Parameters.Add("@4", CoreLab.PostgreSql.PgSqlType.ByteA)
dim b as byte()
b = Convert.FromBase64String("test")
com.Parameters("@1").Value = partner_id
com.Parameters("@2").Value = autoren_id
com.Parameters("@3").Value = titel
com.Parameters("@4").Value = b
com.Connection = dh.GetConnection()
com.ExecuteNonQuery()