Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Insert 参数化 批量插入异常 #92

Open
d4ilys opened this issue Nov 25, 2024 · 1 comment
Open

Insert 参数化 批量插入异常 #92

d4ilys opened this issue Nov 25, 2024 · 1 comment

Comments

@d4ilys
Copy link

d4ilys commented Nov 25, 2024

   var connection =
       new TDengineConnection(
           "host=localhost;port=6030;username=root;password=taosdata;protocol=Native;db=test;");
   connection.Open();
   using var command = new TDengineCommand(connection);
   command.CommandText =
       "INSERT INTO `freesql_test`.`d1001`(`ts`, `current`, `voltage`, `describe`) VALUES(?, ?, ?, ?), (?, ?, ?, ?)";
   command.Parameters.Add(new TDengineParameter("@ts_0", DateTime.Now) { DbType = DbType.DateTime });
   command.Parameters.Add(new TDengineParameter("@current_0", 2) { DbType = DbType.Single });
   command.Parameters.Add(new TDengineParameter("@voltage_0", 2) { DbType = DbType.Int32 });
   command.Parameters.Add(new TDengineParameter("@describe_0", "d1001") { DbType = DbType.String });

   command.Parameters.Add(new TDengineParameter("@ts_2", DateTime.Now) { DbType = DbType.DateTime });
   command.Parameters.Add(new TDengineParameter("@current_2", 1) { DbType = DbType.Single });
   command.Parameters.Add(new TDengineParameter("@voltage_2", 2) { DbType = DbType.Int32 });
   command.Parameters.Add(new TDengineParameter("@describe_2", "test") { DbType = DbType.String });

   command.CommandType = CommandType.Text;
   command.Connection = connection;
   var executeNonQuery = command.ExecuteNonQuery();

1732523555941

@huskar-t
Copy link
Collaborator

参数化方式不支持批量插入

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants