run.csx
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.SqlClient;
using System.Data;
public static void Run(TimerInfo myTimer, ILogger log)
{
ConnectDatabase(log);
}
private static void ConnectDatabase(ILogger log)
{
log.LogWarning("ConnectDatabase Start");
string conString = "Server=tcp:mydbsvr01.database.windows.net,1433;Initial Catalog=mydb01;Persist Security Info=False;User ID=user01;Password=pw01;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;";
SqlConnection myConnection = new SqlConnection(conString);
SqlCommand myCommand = new SqlCommand();
myCommand.Connection = myConnection;
myCommand.CommandText = "pr_Test";
myConnection.Open();
int rows = myCommand.ExecuteNonQuery();
myConnection.Close();
System.Console.WriteLine(rows);
log.LogWarning("ConnectDatabase End");
}
Comments