日期:2014-05-18 浏览次数:21043 次
public int AddGpsBarcode(int CustomerID, string BarcodeNO, int Type)
{
try
{
string sqlStr = "insert into Tab_CustomerBarcode(CB_ID,CB_CustomerID,CB_BarcodeNO,CB_Type,CB_State,CB_UpdateTime) values (@newGuid,@CustomerID,@BarcodeNO,@Type,0,@UpdateTime)";
sqlCommand = new SqlCommand(sqlStr, sqlConnection);
sqlCommand.Parameters.Add(new SqlParameter("@newGuid", SqlDbType.UniqueIdentifier, 16));
sqlCommand.Parameters["@newGuid"].Value = Guid.NewGuid();
sqlCommand.Parameters.Add(new SqlParameter("@CustomerID", SqlDbType.Int, 4));
sqlCommand.Parameters["@CustomerID"].Value = CustomerID;
sqlCommand.Parameters.Add(new SqlParameter("@BarcodeNO", SqlDbType.VarChar, 50));
sqlCommand.Parameters["@BarcodeNO"].Value = BarcodeNO;
sqlCommand.Parameters.Add(new SqlParameter("@Type", SqlDbType.Int, 4));
sqlCommand.Parameters["@Type"].Value = Type;
sqlCommand.Parameters.Add(new SqlParameter("@UpdateTime", SqlDbType.DateTime, 8));
sqlCommand.Parameters["@UpdateTime"].Value = DateTime.Now;
return sqlCommand.ExecuteNonQuery();
}
catch (Exception ex)
{
throw ex;
}
finally
{
if (sqlCommand != null)
{
sqlCommand.Dispose();
}
sqlConnection.Close();
}
}