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


C# SqlCommand.set_CommandType方法代码示例

本文整理汇总了C#中System.Data.SqlClient.SqlCommand.set_CommandType方法的典型用法代码示例。如果您正苦于以下问题:C# SqlCommand.set_CommandType方法的具体用法?C# SqlCommand.set_CommandType怎么用?C# SqlCommand.set_CommandType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Data.SqlClient.SqlCommand的用法示例。


在下文中一共展示了SqlCommand.set_CommandType方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ExecuteDataSet

		public DataSet ExecuteDataSet()
		{
			DataSet dataSet;
			using (SqlConnection sqlConnection = new SqlConnection(Constants.Config.ConnectionString))
			{
				SqlCommand sqlCommand = new SqlCommand(this.Name, sqlConnection);
				sqlCommand.set_CommandType(4);
				sqlCommand.set_CommandTimeout(120);
				IEnumerator enumerator = this.StoredProcParams.GetEnumerator();
				try
				{
					while (enumerator.MoveNext())
					{
						StoredProcParam storedProcParam = (StoredProcParam)enumerator.get_Current();
						sqlCommand.get_Parameters().Add(storedProcParam.ParamID, storedProcParam.ParamValue);
					}
				}
				finally
				{
					IDisposable disposable = enumerator as IDisposable;
					if (disposable != null)
					{
						disposable.Dispose();
					}
				}
				dataSet = new DataSet();
				SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(sqlCommand);
				sqlDataAdapter.Fill(dataSet);
			}
			return dataSet;
		}
开发者ID:demonzhq,项目名称:JLR,代码行数:31,代码来源:StoredProc.cs

示例2: ExecuteScalar

		public int ExecuteScalar()
		{
			int result = 0;
			using (SqlConnection sqlConnection = new SqlConnection(Constants.Config.ConnectionString))
			{
				SqlCommand sqlCommand = new SqlCommand(this.Name, sqlConnection);
				sqlCommand.set_CommandType(4);
				sqlCommand.set_CommandTimeout(120);
				IEnumerator enumerator = this.StoredProcParams.GetEnumerator();
				try
				{
					while (enumerator.MoveNext())
					{
						StoredProcParam storedProcParam = (StoredProcParam)enumerator.get_Current();
						sqlCommand.get_Parameters().Add(storedProcParam.ParamID, storedProcParam.ParamValue);
					}
				}
				finally
				{
					IDisposable disposable = enumerator as IDisposable;
					if (disposable != null)
					{
						disposable.Dispose();
					}
				}
				sqlConnection.Open();
				result = Convert.ToInt32(sqlCommand.ExecuteScalar());
				sqlConnection.Close();
			}
			return result;
		}
开发者ID:demonzhq,项目名称:JLR,代码行数:31,代码来源:StoredProc.cs

示例3: GetUser

		public static DataSet GetUser()
		{
			DataSet dataSet = new DataSet("User");
			using (SqlConnection sqlConnection = new SqlConnection(Constants.Config.ConnectionString))
			{
				SqlCommand sqlCommand = new SqlCommand("upGetUsers", sqlConnection);
				sqlCommand.set_CommandType(4);
				SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(sqlCommand);
				sqlDataAdapter.Fill(dataSet);
			}
			return dataSet;
		}
开发者ID:demonzhq,项目名称:JLR,代码行数:12,代码来源:DataAccess.cs

示例4: GetVehicleBuild

		public static DataSet GetVehicleBuild(bool showAll)
		{
			DataSet dataSet = new DataSet("VehicleBuild");
			using (SqlConnection sqlConnection = new SqlConnection(Constants.Config.ConnectionString))
			{
				int num = Convert.ToInt32(showAll);
				SqlCommand sqlCommand = new SqlCommand("upGetVehicleBuilds", sqlConnection);
				sqlCommand.set_CommandType(4);
				sqlCommand.get_Parameters().Add("@ShowAll", num);
				SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(sqlCommand);
				sqlDataAdapter.Fill(dataSet);
			}
			return dataSet;
		}
开发者ID:demonzhq,项目名称:JLR,代码行数:14,代码来源:DataAccess.cs

示例5: GetParameterSets

		public static DataSet GetParameterSets(int vehicleBuild, int buildType)
		{
			DataSet dataSet = new DataSet("Parameter");
			using (SqlConnection sqlConnection = new SqlConnection(Constants.Config.ConnectionString))
			{
				SqlCommand sqlCommand = new SqlCommand("upGetParameters", sqlConnection);
				sqlCommand.get_Parameters().Add("@VehicleBuildID", vehicleBuild);
				sqlCommand.get_Parameters().Add("@BuildType", buildType);
				sqlCommand.set_CommandType(4);
				SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(sqlCommand);
				sqlDataAdapter.Fill(dataSet);
			}
			return dataSet;
		}
开发者ID:demonzhq,项目名称:JLR,代码行数:14,代码来源:DataAccess.cs

示例6: PrepareCommand

 private static System.Data.SqlClient.SqlCommand PrepareCommand(System.Data.SqlClient.SqlTransaction trans, string sql, System.Data.SqlClient.SqlParameter[] parameters)
 {
     System.Data.SqlClient.SqlCommand command = new System.Data.SqlClient.SqlCommand(sql, Connection, trans);
     command.set_CommandType(System.Data.CommandType.Text);
     command.set_CommandTimeout(0);
     if (parameters != null)
     {
         command.Parameters.AddRange(parameters);
     }
     foreach (System.Data.SqlClient.SqlParameter parameter in command.Parameters)
     {
         if (parameter.get_Value() == null)
         {
             parameter.set_Value(System.DBNull.Value);
         }
         if ((parameter.SqlDbType == System.Data.SqlDbType.DateTime) && parameter.get_Value().Equals(new System.DateTime(1, 1, 1)))
         {
             parameter.set_Value(System.DBNull.Value);
         }
     }
     return command;
 }
开发者ID:u4097,项目名称:SQLScript,代码行数:22,代码来源:DALSql.cs

示例7: ExecuteReturnVal

		public int ExecuteReturnVal()
		{
			int result = 0;
			using (SqlConnection sqlConnection = new SqlConnection(Constants.Config.ConnectionString))
			{
				SqlCommand sqlCommand = new SqlCommand(this.Name, sqlConnection);
				sqlCommand.set_CommandType(4);
				sqlCommand.set_CommandTimeout(120);
				SqlParameter sqlParameter = new SqlParameter("@RETURN", 8);
				sqlParameter.set_Direction(6);
				sqlCommand.get_Parameters().Add(sqlParameter);
				IEnumerator enumerator = this.StoredProcParams.GetEnumerator();
				try
				{
					while (enumerator.MoveNext())
					{
						StoredProcParam storedProcParam = (StoredProcParam)enumerator.get_Current();
						sqlCommand.get_Parameters().Add(storedProcParam.ParamID, storedProcParam.ParamValue);
					}
				}
				finally
				{
					IDisposable disposable = enumerator as IDisposable;
					if (disposable != null)
					{
						disposable.Dispose();
					}
				}
				sqlConnection.Open();
				sqlCommand.ExecuteNonQuery();
				sqlConnection.Close();
				result = (int)sqlParameter.get_Value();
			}
			return result;
		}
开发者ID:demonzhq,项目名称:JLR,代码行数:35,代码来源:StoredProc.cs

示例8: GetVehicleBuildID

		public static int GetVehicleBuildID(string vehicleInstID)
		{
			int result = 0;
			using (SqlConnection sqlConnection = new SqlConnection(Constants.Config.ConnectionString))
			{
				SqlCommand sqlCommand = new SqlCommand("upGetVehicleBuildIDByVehicleInst", sqlConnection);
				sqlCommand.set_CommandType(4);
				sqlCommand.get_Parameters().Add("@VehicleInst", vehicleInstID);
				sqlConnection.Open();
				result = Convert.ToInt32(sqlCommand.ExecuteScalar());
				sqlConnection.Close();
			}
			return result;
		}
开发者ID:demonzhq,项目名称:JLR,代码行数:14,代码来源:DataAccess.cs

示例9: GetVehicleInstParameters

		public static DataSet GetVehicleInstParameters(string vehicleInstId)
		{
			DataSet dataSet = new DataSet("VehicleInst");
			using (SqlConnection sqlConnection = new SqlConnection(Constants.Config.ConnectionString))
			{
				SqlCommand sqlCommand = new SqlCommand("upGetVehicleInstParameters", sqlConnection);
				sqlCommand.set_CommandType(4);
				sqlCommand.get_Parameters().Add("@VehicleInstID", vehicleInstId);
				SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(sqlCommand);
				sqlDataAdapter.Fill(dataSet);
			}
			return dataSet;
		}
开发者ID:demonzhq,项目名称:JLR,代码行数:13,代码来源:DataAccess.cs

示例10: GetAdministrator

		public static DataSet GetAdministrator(string userId)
		{
			DataSet dataSet = new DataSet("User");
			using (SqlConnection sqlConnection = new SqlConnection(Constants.Config.ConnectionString))
			{
				SqlCommand sqlCommand = new SqlCommand("upGetAdministrator", sqlConnection);
				sqlCommand.set_CommandType(4);
				sqlCommand.get_Parameters().Add("@UserID", userId);
				SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(sqlCommand);
				sqlDataAdapter.Fill(dataSet);
			}
			return dataSet;
		}
开发者ID:demonzhq,项目名称:JLR,代码行数:13,代码来源:DataAccess.cs


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