Created
April 16, 2014 12:00
-
-
Save NeilRobbins/10861604 to your computer and use it in GitHub Desktop.
Demonstrates an issue with Vertica 6.1.3 where VerticaCommands with parameters cannot contain more than one statement.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void M(string[] args) | |
{ | |
var builder = new VerticaConnectionStringBuilder | |
{ | |
Host = "54.83.238.208", | |
Database = "Test", | |
User = "dbadmin", | |
Password = "password", | |
Port = 5433, | |
Pooling = true, | |
ConnectionTimeout = 360 | |
}; | |
using (var connection = new VerticaConnection(builder.ConnectionString)) | |
{ | |
using (var command = connection.CreateCommand()) | |
{ | |
// drop schema if exists f; | |
// create schema f; | |
// create table f.test(id INT, username VARCHAR, email VARCHAR, password VARCHAR); | |
command.CommandText = "INSERT INTO j.test VALUES(@ID, 'blah','blah','blah') ; SELECT id FROM j.test LIMIT 1;"; | |
connection.Open(); | |
var param1 = new VerticaParameter("ID", VerticaType.BigInt) {Value = 100}; | |
command.Parameters.Add(param1); | |
var rowsAdded = command.ExecuteScalar(); | |
Console.WriteLine("Added {0} rows!", rowsAdded); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment