I want save 2-dim array in postgresql some like this: int[,] arr = {{1, 2}, {3, 4}};
I am using the following sql statement which is working fine to 1-dim array, but it is not work for 2-dim array.
try
{
string sql1 = "INSERT INTO tbtest(col) VALUES (ARRAY[" + string.Join(", ", arr) + "])";
dbcmd.CommandText = sql1;
dbcmd.ExecuteNonQuery();
}
catch (NpgsqlException ex)
{
if (ex.Data == null)
{
throw;
}
else
{
}
}
How can I do this?
ARRAY[]should have adjusted for multidimensional format.