本文整理汇总了C#中Connection.createSqlServerConnection方法的典型用法代码示例。如果您正苦于以下问题:C# Connection.createSqlServerConnection方法的具体用法?C# Connection.createSqlServerConnection怎么用?C# Connection.createSqlServerConnection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Connection
的用法示例。
在下文中一共展示了Connection.createSqlServerConnection方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: insertEvent
public void insertEvent(int locID, int catID, int useID, string decr, DateTime date)
{
DataTable dt = new DataTable();
Connection dataConnecter = new Connection();
SqlConnection con = new SqlConnection(dataConnecter.createSqlServerConnection());
SqlCommand com = new SqlCommand();
com.CommandText = "sp_InsertEvent";
com.CommandType = CommandType.StoredProcedure;
com.Parameters.Add("@LocationID", SqlDbType.Int).Value = locID;
com.Parameters.Add("@CategoryID", SqlDbType.Int).Value = catID;
com.Parameters.Add("@UserID", SqlDbType.Int).Value = useID;
com.Parameters.Add("@Descr", SqlDbType.VarChar).Value = decr;
com.Parameters.Add("@EventDate", SqlDbType.DateTime).Value = date;
com.Parameters.Add("@Active", SqlDbType.Bit).Value = true;
com.Connection = con;
con.Open();
com.ExecuteNonQuery();
con.Close();
}
示例2: insertLog
public void insertLog(int userID, DateTime logTime, string descr, string progLoc, string message)
{
DataTable dt = new DataTable();
Connection dataConnecter = new Connection();
SqlConnection con = new SqlConnection(dataConnecter.createSqlServerConnection());
SqlCommand com = new SqlCommand();
com.CommandText = "sp_InsertLog";
com.CommandType = CommandType.StoredProcedure;
com.Parameters.Add("@UserID", SqlDbType.VarChar).Value = userID;
com.Parameters.Add("@Logtime", SqlDbType.DateTime).Value = logTime;
com.Parameters.Add("@Descr", SqlDbType.VarChar).Value = descr;
com.Parameters.Add("@ProgramLocation", SqlDbType.VarChar).Value = progLoc;
com.Parameters.Add("@Message", SqlDbType.VarChar).Value = message;
com.Connection = con;
con.Open();
com.ExecuteNonQuery();
con.Close();
}
示例3: getLocPickList
public DataTable getLocPickList()
{
DataTable dt = new DataTable();
SqlDataAdapter adapter;
Connection dataConnecter = new Connection();
SqlConnection con = new SqlConnection(dataConnecter.createSqlServerConnection());
SqlCommand com = new SqlCommand();
com.CommandText = "sp_GetLocationPickList";
com.CommandType = CommandType.StoredProcedure;
com.Connection = con;
adapter = new SqlDataAdapter(com);
adapter.Fill(dt);
con.Close();
return dt;
}
示例4: getMap
public DataTable getMap()
{
DataTable dt = new DataTable();
SqlDataAdapter adapter;
Connection dataConnecter = new Connection();
SqlConnection con = new SqlConnection(dataConnecter.createSqlServerConnection("sqlinstance-1.cnsq0dkjy1df.us-west-2.rds.amazonaws.com,1433", "CMAS", "*050987Wwhite", "awsuserwill"));
SqlCommand com = new SqlCommand();
com.CommandText = "MapProcedure";
com.CommandType = CommandType.StoredProcedure;
com.Connection = con;
adapter = new SqlDataAdapter(com);
adapter.Fill(dt);
con.Close();
return dt;
}
示例5: getEmailList
public DataTable getEmailList()
{
DataTable dt = new DataTable();
SqlDataAdapter adapter;
Connection dataConnecter = new Connection();
SqlConnection con = new SqlConnection(dataConnecter.createSqlServerConnection());
SqlCommand com = new SqlCommand();
//this needs to be updated with the proper email sp
com.CommandText = "sp_getEmailPickList";
com.CommandType = CommandType.StoredProcedure;
com.Connection = con;
adapter = new SqlDataAdapter(com);
adapter.Fill(dt);
con.Close();
return dt;
}
示例6: getEventByID
public DataTable getEventByID(int ID)
{
DataTable dt = new DataTable();
SqlDataAdapter adapter;
Connection dataConnecter = new Connection();
SqlConnection con = new SqlConnection(dataConnecter.createSqlServerConnection());
SqlCommand com = new SqlCommand();
com.CommandText = "sp_GetEventByID";
com.CommandType = CommandType.StoredProcedure;
com.Parameters.Add("@EventID", SqlDbType.Int).Value = ID;
com.Connection = con;
adapter = new SqlDataAdapter(com);
adapter.Fill(dt);
con.Close();
return dt;
}