TDengine/docs/examples/csharp/native-example/ConnectExample.cs
xiaolei li ea26153346
docs: csharp 3.0 cloud doc and sample (#16630)
* docs(cloud):Add C# could doc and examples

* docs(cloud):update C# Cloud docs
2022-09-02 18:51:12 +08:00

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