当前位置: 首页>>代码示例>>C#>>正文


C# Connection.createSqlServerConnection方法代码示例

本文整理汇总了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();
        }
开发者ID:BabbageCodeMonkey,项目名称:CMAS,代码行数:26,代码来源:EventMapper.cs

示例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();
        }
开发者ID:BabbageCodeMonkey,项目名称:CMAS,代码行数:25,代码来源:LogMapper.cs

示例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;
        }
开发者ID:BabbageCodeMonkey,项目名称:CMAS,代码行数:21,代码来源:LocationMapper.cs

示例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;
        }
开发者ID:BabbageCodeMonkey,项目名称:CMAS,代码行数:21,代码来源:GetMap.cs

示例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;
        }
开发者ID:BabbageCodeMonkey,项目名称:CMAS,代码行数:22,代码来源:EmailMapper.cs

示例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;
        }
开发者ID:BabbageCodeMonkey,项目名称:CMAS,代码行数:23,代码来源:EventMapper.cs


注:本文中的Connection.createSqlServerConnection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。