TDengine/docs/examples/csharp/connect/Program.cs
xiaolei li c577897c1f
test(docs):change docs-example file structure and update reference (#16987)
* test(docs):update docs-example file structure

* test(docs):update docs-example references under zh and en
2022-09-22 09:58:31 +08:00

29 lines
733 B
C#

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)
{
throw new Exception("Connect to TDengine failed");
}
else
{
Console.WriteLine("Connect to TDengine success");
}
TDengine.Close(conn);
TDengine.Cleanup();
}
}
}