Answer Posted / santro
/*DrugNames DalCls.cs*/
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using MySql.Data.MySqlClient;
using System.Windows.Forms;
using System.IO;
using MedWare;
/// <summary>
/// Summary description for DrugNamesDalCls
/// </summary>
public class DrugNamesDalCls
{
MySqlConnection mysqlcon = new MySqlConnection
(System.Configuration.ConfigurationManager.AppSettings
["strDrugs"].ToString());
public DrugNamesDalCls()
{
//
// TODO: Add constructor logic here
//
}
public void ErrorMsg(string strError)
{
string strErrorPath =
HttpContext.Current.Server.MapPath("Errordetails.txt");
using (FileStream fs = File.Open(strErrorPath,
FileMode.Append, FileAccess.Write))
{
using (StreamWriter sw = new StreamWriter(fs))
{
sw.WriteLine
("..........................................................
............................");
//sw.WriteLine("ApplicationName:" +
strAppUrl);
sw.WriteLine("Error:" + strError);
sw.WriteLine("Creation Date:" +
DateTime.Now);
sw.WriteLine
("..........................................................
............................");
}
}
}
//FUNCTION FOR INSERT TRANSACTION.
public int InsertDrugName(string pstrDrugName)
{
int irec = 0;
string strDate=DateTime.Now.ToString();
//string strIns = "INSERT INTO DRUGNAME VALUES('" +
pstrDrugName + "')";
string strIns = "INSERT INTO DRUGNAME (DrugName)
values('" + pstrDrugName + "')";
try
{
irec = new DrugNamesDblCls().InsDelUpdate
(strIns);
}
catch (Exception ex)
{
ErrorMsg(ex.Message);
}
return irec;
}
//FUNCTION FOR UPDATE TRANSACTION.
public int UpdateDrugName(string strDrugName, string
DrugNameID)
{
int irec = 0;
string strUpdate = "UPDATE drugname SET DRUGNAME='"
+ strDrugName + "' WHERE DRUGNAMEID=" + DrugNameID;
try
{
irec = new DrugNamesDblCls().InsDelUpdate
(strUpdate);
}
catch (Exception ex)
{
ErrorMsg(ex.Message);
}
return irec;
}
// FUNCTION FOR DELETE TRANSACTION.
public int DeleteDrugName(string strDrugNameID)
{
int irec = 0;
string strDel = "DELETE FROM drugname WHERE
drugname='" + strDrugNameID + "'";
try
{
irec = new DrugNamesDblCls().InsDelUpdate
(strDel);
}
catch (Exception ex)
{
ErrorMsg(ex.Message);
}
return irec;
}
}
| Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
If you could go back in time to any period of time when it would be and why?
Should airlines be allowed to charge people for using the toilet on a plane?
What is the TDS rules for a NRI who is partner in Partnership Firm in India and on retirement he gets Rs. 150 Lacs equal to the credit balance in his capital account. This credit in his capital account has come on account of revaluation of immovable property owned by thr firm. What is the Firm's liability towards income tax on revaluation of immovable property and what are the obligation of TDS while making payment to the NRI.
what is legal process of adopting a child?
Would it be a good idea for there to be a minimum IQ for jurors in a trial?
what is the rule of WCT TAx refund in the state of jammu & kashmir.if we don't have sales tax registration number in J&K state.we are the Ups supplier from other State.we have the trading business only.
Your client is determined to take a case to court even though you believe he has no chance of winning and have advised him strongly not to do so. What do you do?
How to break service bond
What is the minimum distance to be maintained from a residence area to oil depot ? Please mention the act name according which it is mentioned ?
without vat/tax invoice, a company can take credit in case of purchase.& why ?
who is the first law officer of government of india ?
What is the service tax rate on WCT ( work contract tax) in haryana state
how much important to get police clearance from local police station to Canadian visa?(Work visa)
How you will react if you find that someone you work with does not like you?
Should the law be black and white, or should it be flexible enough to look at each case on an individual basis?