本文整理汇总了C#中System.Data.SqlClient.SqlParameter类的典型用法代码示例。如果您正苦于以下问题:C# System.Data.SqlClient.SqlParameter类的具体用法?C# System.Data.SqlClient.SqlParameter怎么用?C# System.Data.SqlClient.SqlParameter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
System.Data.SqlClient.SqlParameter类属于命名空间,在下文中一共展示了System.Data.SqlClient.SqlParameter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: btnPreg_Click
private void btnPreg_Click(object sender, EventArgs e)
{
if (this.txtPreg.Text == string.Empty)
{
MessageBox.Show("Ingrese un texto para la pregunta");
return;
}
// Creo la pregunta
//Abro la conexion
AccesoDatos.getInstancia().abrirConexion();
System.Data.SqlClient.SqlCommand comVenta = new System.Data.SqlClient.SqlCommand("LOS_GESTORES.sp_app_creaPregunta");
System.Data.SqlClient.SqlParameter p1V = new System.Data.SqlClient.SqlParameter("@id_usu", this.id_comprador);
comVenta.Parameters.Add(p1V);
System.Data.SqlClient.SqlParameter p2V = new System.Data.SqlClient.SqlParameter("@id_pub", this.id_pub);
comVenta.Parameters.Add(p2V);
System.Data.SqlClient.SqlParameter p3V = new System.Data.SqlClient.SqlParameter("@txt", this.txtPreg.Text.Trim());
comVenta.Parameters.Add(p3V);
System.Data.SqlClient.SqlParameter p4V = new System.Data.SqlClient.SqlParameter("@fecha", this.fecha_hoy);
comVenta.Parameters.Add(p4V);
System.Data.SqlClient.SqlDataReader rolReader = AccesoDatos.getInstancia().ejecutaSP(comVenta);
//Cierro la conexion
AccesoDatos.getInstancia().cerrarConexion();
MessageBox.Show("Su pregunta se ha registrado con exito");
this.Close();
}
开发者ID:pablobergna,项目名称:TPDATOS,代码行数:35,代码来源:Preguntar.cs
示例2: AddParameter
public void AddParameter(string name, object value, System.Data.DbType paramtype)
{
System.Data.SqlClient.SqlParameter param = new System.Data.SqlClient.SqlParameter(name, paramtype);
param.Value = value;
comm.Parameters.Add(param);
}
开发者ID:xescrp,项目名称:breinstormin,代码行数:7,代码来源:SQLServerEngine.cs
示例3: GetParameter
private System.Data.DataRow GetParameter(string IDParametro, int? IDPortal, int? IDSistema, string IDUsuario)
{
// Aca se lee la informacion de la base de datos
// y se preparan los layers
string connStr = ValidacionSeguridad.Instance.GetSecurityConnectionString();
System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(connStr);
conn.Open();
System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand
("SELECT * FROM dbo.SF_VALOR_PARAMETRO(@IDParametro, @IDPortal, @IDSistema, @IDUsuario)", conn);
System.Data.SqlClient.SqlParameter prm = new System.Data.SqlClient.SqlParameter("@IDParametro", System.Data.SqlDbType.VarChar, 100);
prm.Value = IDParametro;
cmd.Parameters.Add(prm);
prm = new System.Data.SqlClient.SqlParameter("@IDPortal", System.Data.SqlDbType.Int);
if (IDPortal.HasValue)
{
prm.Value = IDPortal.Value;
}
else
{
prm.Value = null;
}
cmd.Parameters.Add(prm);
prm = new System.Data.SqlClient.SqlParameter("@IDSistema", System.Data.SqlDbType.Int);
if (IDSistema.HasValue)
{
prm.Value = IDSistema.Value;
}
else
{
prm.Value = null;
}
cmd.Parameters.Add(prm);
prm = new System.Data.SqlClient.SqlParameter("@IDUsuario", System.Data.SqlDbType.VarChar);
if (IDUsuario != null)
{
prm.Value = IDUsuario;
}
else
{
prm.Value = null;
}
cmd.Parameters.Add(prm);
// IdParametro, Alcance, ValorTexto, ValorEntero, ValorDecimal, ValorLogico, ValorFechaHora
cmd.CommandType = System.Data.CommandType.Text;
System.Data.SqlClient.SqlDataAdapter da = new System.Data.SqlClient.SqlDataAdapter(cmd);
System.Data.DataSet ds = new System.Data.DataSet();
da.Fill(ds);
conn.Close();
return ds.Tables[0].Rows[0];
//return resultado;
}
开发者ID:diegowald,项目名称:intellitrack,代码行数:60,代码来源:UDPHandler.cs
示例4: GetSPResult
public DataTable GetSPResult(string editor, string dbName, string spName, string[] ParameterNameArray, string[] ParameterValueArray)
{
if (ParameterNameArray == null || ParameterValueArray == null)
{
return null;
}
string ParameterValuesStr = "";
System.Data.SqlClient.SqlParameter[] paramsArray = new System.Data.SqlClient.SqlParameter[ParameterNameArray.Length];
for (int i = 0; i < ParameterNameArray.Length; i++)
{
paramsArray[i] = new System.Data.SqlClient.SqlParameter(ParameterNameArray[i].StartsWith("@") ? ParameterNameArray[i] : "@" + ParameterNameArray[i], ParameterValueArray[i]);
ParameterValuesStr = ParameterValuesStr + paramsArray[i].ParameterName + "=" + ParameterValueArray[i] + ",";
}
ExecSQLLogger.Info("editor is: " + editor + ", Database is: " + dbName + ", SPName is: " + spName + ", Parameters is :" + ParameterValuesStr.TrimEnd(new char[] { ',' }));
IProductRepository MyRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IMES.FisObject.FA.Product.IProduct>();
string ConnectString = string.Format(IMES.Infrastructure.Repository._Schema.SqlHelper.ConnectionString, dbName);
try
{
return IMES.Infrastructure.Repository._Schema.SqlHelper.ExecuteDataFillConsiderOutParams(ConnectString, CommandType.StoredProcedure, spName, paramsArray);
}
catch (Exception e)
{
ExecSQLLogger.Error(e.Message, e);
throw e;
}
}
开发者ID:wra222,项目名称:testgit,代码行数:29,代码来源:CommonFunction.cs
示例5: GetSQLResult
public DataSet GetSQLResult(string editor, string dbName, string sqlText, string[] ParameterNameArray, string[] ParameterValueArray)
{
ExecSQLLogger.Info("editor is: " + editor + ", Database is: " + dbName + ", ExecSQL is: " + "SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; \n" + sqlText);
System.Data.SqlClient.SqlParameter[] paramsArray = null;
if (ParameterNameArray != null && ParameterValueArray != null && ParameterNameArray.Length == ParameterValueArray.Length)
{
paramsArray = new System.Data.SqlClient.SqlParameter[ParameterNameArray.Length];
for (int i = 0; i < ParameterNameArray.Length; i++)
{
paramsArray[i] = new System.Data.SqlClient.SqlParameter(ParameterNameArray[i].StartsWith("@") ? ParameterNameArray[i] : "@" + ParameterNameArray[i], ParameterValueArray[i]);
}
}
sqlText = "SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; \n" + sqlText + " select @@ROWCOUNT as AffectRowCount";
string ConnectString = string.Format(IMES.Infrastructure.Repository._Schema.SqlHelper.ConnectionString, dbName);
if (string.IsNullOrEmpty(dbName))
{
ConnectString = IMES.Infrastructure.Repository._Schema.SqlHelper.ConnectionString_FA;
}
IProductRepository MyRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IMES.FisObject.FA.Product.IProduct>();
try
{
return IMES.Infrastructure.Repository._Schema.SqlHelper.ExecSPorSql(ConnectString, CommandType.Text, sqlText, paramsArray);
}
catch (Exception e)
{
ExecSQLLogger.Error(e.Message, e);
throw e;
}
}
开发者ID:wra222,项目名称:testgit,代码行数:31,代码来源:CommonFunction.cs
示例6: DbCommandAsync
private static async Task DbCommandAsync(Phone p)
{
using (MobileContext db = new MobileContext())
{
System.Data.SqlClient.SqlParameter name = new System.Data.SqlClient.SqlParameter("name", p.Name);
System.Data.SqlClient.SqlParameter price = new System.Data.SqlClient.SqlParameter("price", p.Price);
await db.Database.ExecuteSqlCommandAsync("INSERT INTO Phones (Name, Price) VALUES (@name, @price)", name, price);
}
}
开发者ID:Alexis1784,项目名称:EF_lesson_8_1,代码行数:9,代码来源:Program.cs
示例7: GetLichSuTonKho
public static System.Data.Objects.ObjectResult<BAOCAOLICHSUTONKHO> GetLichSuTonKho(KaraokeEntities kara, int KhoID, DateTime dtFrom, DateTime dtTo)
{
var Parameter_KhoID = new System.Data.SqlClient.SqlParameter("@KhoID", System.Data.SqlDbType.Int);
Parameter_KhoID.Value = KhoID;
var Parameter_DateFrom = new System.Data.SqlClient.SqlParameter("@DateFrom", System.Data.SqlDbType.DateTime);
Parameter_DateFrom.Value = dtFrom;
var Parameter_DateTo = new System.Data.SqlClient.SqlParameter("@DateTo", System.Data.SqlDbType.DateTime);
Parameter_DateTo.Value = dtTo;
return kara.ExecuteStoreQuery<BAOCAOLICHSUTONKHO>("SP_BAOCAOLICHSUTONKHO @KhoID, @DateFrom, @DateTo", Parameter_KhoID, Parameter_DateFrom, Parameter_DateTo);
}
开发者ID:MisterTobi,项目名称:restaurant-cafe,代码行数:10,代码来源:BOLichSuTonKho.cs
示例8: Save
public bool Save(string CodAntena, string TagEquipo)
{
// Aca se graba la informacion en la base de datos.
//1. Para el caso RFID, donde del Agente está escuchando o leyendo los Data Logger cada 15 segundos se debe ejecutar la siguiente SP con los parámetros que se detallan:
//-----------------------------------------------------------------------------------------------------------------------
//-- Declare type parameter
//DECLARE @RC int --Valor de retorno 0=OK
//DECLARE @CODANTENA varchar(4) --Código de antena
//DECLARE @TAGEQUIPO varchar(16) --Nro de Tag del equipo/camión
//-- Set parameter values
//SET @CODANTENA = '0001'
//SET @TAGEQUIPO = 'A000000000000112'
//EXEC @RC = [TARJA].[dbo].[STP_MOVIMIENTOS_PUNTOS_CONTROL] @CODANTENA, @TAGEQUIPO
//-----------------------------------------------------------------------------------------------------------------------
// Para los códigos de las antenas determinamos la siguiente codificación:
// 1 = Trapiche 1
//2 = Trapiche 2
//3 = Trapiche 3
//4 = Bascula 9
//5 = Bascula 10
//6 = Portería Gas
//7 = Portería Gas Interno)
try
{
string strConnection = GetConnectionString();
System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(strConnection);
conn.Open();
System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand();
cmd.Connection = conn;
cmd.CommandType = System.Data.CommandType.StoredProcedure;
cmd.CommandText = "STP_MOVIMIENTOS_PUNTOS_CONTROL";
System.Data.SqlClient.SqlParameter prm = new System.Data.SqlClient.SqlParameter("@CODANTENA", System.Data.SqlDbType.VarChar, 4);
prm.Value = CodAntena;
cmd.Parameters.Add(prm);
prm = new System.Data.SqlClient.SqlParameter("@TAGEQUIPO", System.Data.SqlDbType.VarChar, 16);
prm.Value = TagEquipo;
cmd.Parameters.Add(prm);
int rc =(int) cmd.ExecuteScalar();
if (rc == 0)
return true;
else
return false;
}
catch (Exception)
{
return false;
}
}
开发者ID:diegowald,项目名称:intellitrack,代码行数:55,代码来源:Save2Database.cs
示例9: getDecimalInputParam
public static System.Data.SqlClient.SqlParameter getDecimalInputParam(string ip_name,
object ip_value)
{
Debug.Assert(ip_name.IndexOf(C_PREFIX_OF_PARAM) >= 0, C_WRONG_PARAM_NAME);
System.Data.SqlClient.SqlParameter v_sqlPara = new System.Data.SqlClient.SqlParameter();
v_sqlPara.SqlDbType = SqlDbType.Decimal;
v_sqlPara.Direction = ParameterDirection.Input;
v_sqlPara.Value = ip_value;
v_sqlPara.ParameterName = ip_name;
return v_sqlPara;
}
开发者ID:nguyendanhtu,项目名称:bki-quan-ly-du-toan,代码行数:11,代码来源:CDBUtils.cs
示例10: NullParameters
public static System.Data.SqlClient.SqlParameter[] NullParameters()
{
System.Data.SqlClient.SqlParameter[] retVal = new System.Data.SqlClient.SqlParameter[4];
retVal[0] = new System.Data.SqlClient.SqlParameter("maxlong", null);
retVal[1] = new System.Data.SqlClient.SqlParameter("minLong", null);
retVal[2] = new System.Data.SqlClient.SqlParameter("maxlat", null);
retVal[3] = new System.Data.SqlClient.SqlParameter("minlat", null);
return retVal;
}
开发者ID:nico15,项目名称:rideshare,代码行数:11,代码来源:GeoBox.cs
示例11: AgeClassGetAll
public override System.Data.IDataReader AgeClassGetAll()
{
System.Data.SqlClient.SqlParameter[] arrSqlParameter = new System.Data.SqlClient.SqlParameter[0];
if ((_SqlTransaction == null))
{
return ((System.Data.IDataReader)(SqlHelper.ExecuteReader(ConnectionString, "usp_AgeClassGetAll", arrSqlParameter)));
}
else
{
return ((System.Data.IDataReader)(SqlHelper.ExecuteReader(_SqlTransaction, "usp_AgeClassGetAll", arrSqlParameter)));
}
}
开发者ID:kdmerkle,项目名称:Swimomatic,代码行数:12,代码来源:SwimomaticServiceProviderSQL.cs
示例12: AgeClassDelete
public override void AgeClassDelete(int AgeClassID)
{
System.Data.SqlClient.SqlParameter[] arrSqlParameter = new System.Data.SqlClient.SqlParameter[] {
new System.Data.SqlClient.SqlParameter("@AgeClassID", Helper.CheckForNullValue(AgeClassID))};
if ((_SqlTransaction == null))
{
SqlHelper.ExecuteNonQuery(ConnectionString, "usp_AgeClassDelete", arrSqlParameter);
}
else
{
SqlHelper.ExecuteNonQuery(_SqlTransaction, "usp_AgeClassDelete", arrSqlParameter);
}
}
开发者ID:kdmerkle,项目名称:Swimomatic,代码行数:13,代码来源:SwimomaticServiceProviderSQL.cs
示例13: AgeClassGet
public override System.Data.IDataReader AgeClassGet(int AgeClassID)
{
System.Data.SqlClient.SqlParameter[] arrSqlParameter = new System.Data.SqlClient.SqlParameter[] {
new System.Data.SqlClient.SqlParameter("@AgeClassID", Helper.CheckForNullValue(AgeClassID))};
if ((_SqlTransaction == null))
{
return ((System.Data.IDataReader)(SqlHelper.ExecuteReader(ConnectionString, "usp_AgeClassGet", arrSqlParameter)));
}
else
{
return ((System.Data.IDataReader)(SqlHelper.ExecuteReader(_SqlTransaction, "usp_AgeClassGet", arrSqlParameter)));
}
}
开发者ID:kdmerkle,项目名称:Swimomatic,代码行数:13,代码来源:SwimomaticServiceProviderSQL.cs
示例14: CheckLogin
public static NHANVIEN CheckLogin(KaraokeEntities kara,string user, string pass)
{
if (!String.IsNullOrEmpty(user) && !String.IsNullOrEmpty(pass))
{
var Parameter_TenDangNhap = new System.Data.SqlClient.SqlParameter("@TenDangNhap", System.Data.SqlDbType.VarChar, 50);
Parameter_TenDangNhap.Value = user;
var Parameter_MatKhau = new System.Data.SqlClient.SqlParameter("@MatKhau", System.Data.SqlDbType.VarChar, 255);
Parameter_MatKhau.Value = pass;
NHANVIEN nv = kara.ExecuteStoreQuery<NHANVIEN>("SP_Login_NhanVien @TenDangNhap, @MatKhau", Parameter_TenDangNhap, Parameter_MatKhau).FirstOrDefault();
return nv;
}
return null;
}
开发者ID:MisterTobi,项目名称:restaurant-cafe,代码行数:13,代码来源:BONhanVien.cs
示例15: GetBaoCaoKhu
public IQueryable<BAOCAOKHU> GetBaoCaoKhu(DateTime dtFrom, DateTime dtTo)
{
//return from x in mKaraokeEntities.BAOCAOKHUs
// where dtFrom.CompareTo(x.NgayBan.Value) <= 0 && dtTo.CompareTo(x.NgayBan.Value) >= 0
// orderby x.TenKhu
// select x;
var paraFrom = new System.Data.SqlClient.SqlParameter("@NgayBatDau", System.Data.SqlDbType.DateTime);
paraFrom.Value = dtFrom;
var paraTo = new System.Data.SqlClient.SqlParameter("@NgayKetThuc", System.Data.SqlDbType.DateTime);
paraTo.Value = dtTo;
var sql = mKaraokeEntities.ExecuteStoreQuery<BAOCAOKHU>("SP_REPORT_BAOCAOKHU @NgayBatDau,@NgayKetThuc", paraFrom, paraTo);
return sql.AsQueryable<BAOCAOKHU>();
}
开发者ID:MisterTobi,项目名称:restaurant-cafe,代码行数:13,代码来源:BOBaoCaoKhu.cs
示例16: GetBaoCaoNgayTong
public static IQueryable<BAOCAONGAYTONG> GetBaoCaoNgayTong(KaraokeEntities kara,DateTime dtFrom, DateTime dtTo)
{
//return from x in kara.BAOCAONGAYTONGs
// where dtFrom.CompareTo(x.NgayBan.Value) <= 0 && dtTo.CompareTo(x.NgayBan.Value) >= 0
// select x;
var paraFrom = new System.Data.SqlClient.SqlParameter("@NgayBatDau", System.Data.SqlDbType.DateTime);
paraFrom.Value = dtFrom;
var paraTo = new System.Data.SqlClient.SqlParameter("@NgayKetThuc", System.Data.SqlDbType.DateTime);
paraTo.Value = dtTo;
var sql = kara.ExecuteStoreQuery<BAOCAONGAYTONG>("SP_REPORT_BAOCAONGAYTONG @NgayBatDau,@NgayKetThuc", paraFrom, paraTo);
return sql.AsQueryable<BAOCAONGAYTONG>();
}
开发者ID:MisterTobi,项目名称:restaurant-cafe,代码行数:13,代码来源:BOBaoCaoNgay.cs
示例17: AMEmpresa_Load
private void AMEmpresa_Load(object sender, EventArgs e)
{
//Chequeo si es una modificacion
if (this.id_usuario != -1)
{
//Traigo la informacion del usuario
System.Data.SqlClient.SqlCommand comUsu = new System.Data.SqlClient.SqlCommand("LOS_GESTORES.sp_app_getUsuarioEmpresaXId");
//Defino los parametros
System.Data.SqlClient.SqlParameter pUsu = new System.Data.SqlClient.SqlParameter("@id", this.id_usuario);
comUsu.Parameters.Add(pUsu);
// Abro la conexion
AccesoDatos.getInstancia().abrirConexion();
System.Data.SqlClient.SqlDataReader usuario = AccesoDatos.getInstancia().ejecutaSP(comUsu);
if (!usuario.HasRows)
{
MessageBox.Show("Usuario invalido");
return;
}
usuario.Read();
this.lblUsu.Text += usuario.GetString(0);
this.lblEstado.Text += usuario.GetString(1);
this.empRazSocial.Text = usuario.GetString(2);
this.empMail.Text = usuario.GetString(3).Trim();
this.empTelefono.Text = usuario.GetString(4).Trim();
this.empDireccion.Text = usuario.GetString(5).Trim();
this.empNroCalle.Text = usuario.GetDecimal(6).ToString().Trim();
this.empNroPiso.Text = usuario.GetDecimal(7).ToString().Trim();
this.empDpto.Text = usuario.GetString(8).Trim();
this.empLocalidad.Text = usuario.GetString(9).Trim();
this.empCodPostal.Text = usuario.GetString(10).Trim();
this.ciudad.Text = usuario.GetString(11).Trim();
this.empCuit.Text = usuario.GetString(12).Trim();
this.empFechaCre.Value = usuario.GetDateTime(13);
this.empContacto.Text = usuario.GetString(14);
// Cierro la conexion
usuario.Close();
AccesoDatos.getInstancia().cerrarConexion();
}
else
{
this.lblUsu.Text += "AUTOGENERADO";
this.lblEstado.Text += "Habilitado";
}
}
开发者ID:pablobergna,项目名称:TPDATOS,代码行数:51,代码来源:AMEmpresa.cs
示例18: LoadData
public void LoadData()
{
System.Data.SqlClient.SqlCommand command = SqlHelper.CreateCommand(DAC.Connection, "GetContactInfoByContactID");
command.CommandType = CommandType.StoredProcedure;
System.Data.SqlClient.SqlParameter pContactID = new System.Data.SqlClient.SqlParameter("@ContactID", System.Data.SqlDbType.Int);
pContactID.Direction = System.Data.ParameterDirection.Input;
pContactID.Value = ContactID;
command.Parameters.Add(pContactID);
if (DAC.Connection.State == ConnectionState.Closed)
{
DAC.Connection.Open();
}
System.Data.SqlClient.SqlDataReader reader = command.ExecuteReader();
while (reader.Read())
{
this.Phone1 = reader["Phone1"].ToString();
this.Phone2 = reader["Phone2"].ToString();
this.OtherPhone = reader["PhoneOther"].ToString();
this.Fax1 = reader["PhoneFax1"].ToString();
this.Fax2 = reader["PhoneFax2"].ToString();
this.Url = reader["Url"].ToString();
this.FirstName = reader["AccountRepFirstName"].ToString();
this.FirstNamePhonetic = reader["AccountRepFirstNamePhonetic"].ToString();
this.FirstNameRomaji = reader["AccountRepFirstNameRomaji"].ToString();
this.LastName = reader["AccountRepLastName"].ToString();
this.LastNamePhonetic = reader["AccountRepLastNamePhonetic"].ToString();
this.LastNameRomaji = reader["AccountRepLastNameRomaji"].ToString();
this.Street1 = reader["Street1"].ToString();
this.Street2 = reader["Street2"].ToString();
this.Street3 = reader["Street3"].ToString();
this.City = reader["City"].ToString();
this.State = reader["State"].ToString();
this.PostalCode = reader["PostalCode"].ToString();
this.Country = reader["Country"].ToString();
this.Block = reader["BlockCode"].ToString();
this.ClosestStation1 = reader["ClosestStation1"].ToString();
this.ClosestStation2 = reader["ClosestStation2"].ToString();
this.ClosestLine1 = reader["ClosestLine1"].ToString();
this.ClosestLine2 = reader["ClosestLine2"].ToString();
this.MinutesToStation1 = reader["MinutesToStation1"].ToString();
this.MinutesToStation2 = reader["MinutesToStation2"].ToString();
}
if (DAC.Connection.State == ConnectionState.Open)
{
DAC.Connection.Close();
}
}
开发者ID:gregggdavis,项目名称:schedww2,代码行数:51,代码来源:clsContactInfo.cs
示例19: bInScheduleWindow
protected Boolean bInScheduleWindow(int SID)
{
System.Data.SqlClient.SqlConnection connection = new System.Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings["TL_Connection_String"].ToString());
System.Data.SqlClient.SqlCommand command = new System.Data.SqlClient.SqlCommand("SELECT BRLSessionAvailabiltyWindowOpen, BRLSessionAvailabiltyWindowClose FROM dbo.tlBRLSessionDates WHERE BRLSessionDateID = @ID", connection);
System.Data.SqlClient.SqlParameter safeID = new System.Data.SqlClient.SqlParameter("@ID", System.Data.SqlDbType.VarChar);
System.Data.SqlClient.SqlDataReader reader = null;
safeID.Value = SID;
command.Parameters.Add(safeID);
//Open The Connection
if (connection.State == System.Data.ConnectionState.Closed)
{
connection.Open();
}
try
{
reader = command.ExecuteReader();
if (reader.HasRows)
{
reader.Read();
DateTime Started = DateTime.Parse(reader["BRLSessionAvailabiltyWindowOpen"].ToString());
DateTime Ends = DateTime.Parse(reader["BRLSessionAvailabiltyWindowClose"].ToString());
connection.Close();
if (DateTime.Now > Started && DateTime.Now < Ends)
return true;
else
return false;
}
else
{
connection.Close();
return false;
}
}
catch (Exception ex)
{
connection.Close();
ErrorLabel.Text = "Database error, try again.</br>" + ex.ToString();
ErrorPanel.Visible = true;
ScanPanel.Visible = true;
SchedulePanel.Visible = false;
DateSelectionPanel.Visible = false;
return false;
}
}
开发者ID:ucfcba,项目名称:behavioral_lab_signup,代码行数:50,代码来源:default.aspx.cs
示例20: btnComprar_Click
private void btnComprar_Click(object sender, EventArgs e)
{
int cant_compra=0;
//Valido los campos numericos
try
{
cant_compra = int.Parse(this.txtCant.Text);
}
catch
{
MessageBox.Show("Debe ingresar una cantidad a comprar numerica");
return;
}
if (cant_compra > int.Parse(this.lblStock.Text))
{
MessageBox.Show("Debe ingresar una cantidad menor o igual al stock disponible");
return;
}
// Creo la venta
//Abro la conexion
AccesoDatos.getInstancia().abrirConexion();
System.Data.SqlClient.SqlCommand comVenta = new System.Data.SqlClient.SqlCommand("LOS_GESTORES.sp_app_creaVenta");
System.Data.SqlClient.SqlParameter p1V = new System.Data.SqlClient.SqlParameter("@id_publ", this.id_pub);
comVenta.Parameters.Add(p1V);
System.Data.SqlClient.SqlParameter p2V = new System.Data.SqlClient.SqlParameter("@id_comprador", this.id_comprador);
comVenta.Parameters.Add(p2V);
System.Data.SqlClient.SqlParameter p3V = new System.Data.SqlClient.SqlParameter("@fecha", this.fecha_hoy);
comVenta.Parameters.Add(p3V);
System.Data.SqlClient.SqlParameter p4V = new System.Data.SqlClient.SqlParameter("@cant", cant_compra);
comVenta.Parameters.Add(p4V);
System.Data.SqlClient.SqlDataReader rolReader = AccesoDatos.getInstancia().ejecutaSP(comVenta);
//Cierro la conexion
AccesoDatos.getInstancia().cerrarConexion();
Comprar_Ofertar.VisVendedor fVend = new VisVendedor();
fVend.idVendedor = this.id_vendedor;
fVend.ShowDialog();
this.Close();
}
开发者ID:pablobergna,项目名称:TPDATOS,代码行数:49,代码来源:VisualizarPub.cs
注:本文中的System.Data.SqlClient.SqlParameter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论