TDengine/docs/examples/csharp/connect/Program.cs

30 lines
733 B
C#
Raw Permalink Normal View History

2022-08-24 10:33:10 +00:00
using TDengineDriver;
namespace TDengineExample
{
internal class ConnectExample
{
static void Main(String[] args)
{
string host = "localhost";
short port = 6030;
string username = "root";
string password = "taosdata";
string dbname = "";
var conn = TDengine.Connect(host, username, password, dbname, port);
if (conn == IntPtr.Zero)
{
2023-03-10 04:07:10 +00:00
throw new Exception("Connect to TDengine failed");
2022-08-24 10:33:10 +00:00
}
else
{
Console.WriteLine("Connect to TDengine success");
}
TDengine.Close(conn);
TDengine.Cleanup();
}
}
}