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
what is the formula for working year calculation in the time of gratuity calculation. if any worker worked 30 years, but during the 30 years he has not worked 3 years, then how many years taken at the time of gratuity calculation.
have special equity issues been encountered?
A Company puts an advert in a local newspaper: 'Buy our brilliant guide to getting into university and we guarantee you will be offered a place at your first choice or your money back and £1000'. James buys the guide, follows its advice but is rejected from everywhere he applies. The Company refuses to give him his money back. Can he sue for breach of contract?
Maximum validity of an ordinance is 6 months or 6 weeks.
What are the pros & cons about juries?
Proof reading,style setting, and fomating of text done by any person is coverd the net of service tax??
Is it possible to stock transfer stock between two company of other state with some agreement without paying cst if yes then witch kind of agreement requard
without vat/tax invoice, a company can take credit in case of purchase.& why ?
if accident happens inside factory causes death of labours, whether police can file criminal case on factory. after file the complaint by the factory and labour inspector. if police can not, then what is the section of factory act will come in that.
what is the due dates of depositing the PF challan & Esic challan.
What is your view on the "sufficient benefit" test in legally aided work?
If the penalty for parking on a double yellow were death, and therefore nobody did it, would that be a just and effective law?
what is the status of companies regarding merger, demerger and amalgamation in India ?
A father promises to give his daughter £100 a week during her time at university. After the first term, he decides she needs to be more self-reliant and stops paying her. Can she sue him for breach of contract?
1.What is stub in software testing ? A dummy sub program A test case,which fails regularly A defect log report A defect ,which is not closed 2. What does 100% code coverage mean while testing software ? Basic flow of software is tested All critical test cases are tested Each line of code is executed at least once while testing . No while and If loops are tested 3. What does GPF in Windows95 stands for ? Great Performance Format General Performance Error General Protection Fault Group Performance Frequency 4. Which of the following best fits for testing boundary values ? Age test box accepts age between 10-20 (both inclusive) Name text box can have any value Date text box should have data in dd/mm/yyyy format Employee Grade text box can have one of the following values L1,M1,E1 5. string somestring; Which of the following choices will convert a standard C++ string object “somestring” to a C string somestring.c_str() &somestring[1] Copy.somestring() Std::cstring(something) 6. Which of the following best suites load scenario ? 100 users chatting in a chat application Testing for compulsory fields in a employee details form Checking for date format in date of birth field 7. What is the function of the modulus operator in most languages ? Sets a system environmental value to either base 10 ,base 8 or base 16 Returns the remainder after dividing one number by another Returns the first argument raised to the second argument power Prints out the actual code written to standard output rather than executing the code 8. class professor{} class teacher: public virtual professor{}; class researcher: public virtual professor {} class myprofessor :public teacher,public researcher {}; Referring to the sample code above ,if an object of class “myprofessor” were created ,how many instances of professor will it contain? 0 1 2 3 9. What function will read a specified number of elements from a file ? fread() readfile() fileread() gets() 10. What is the largest value an integer can hold in a Standard C compiler ? 32767 65536 2147483647 INT_MAX 11. With every use of memory allocation function should be used to release allocated memory which is no longer needed ? dropmem() dealloc() release() free() 12. Modern RDBMS’s perfom the following the following functionc except ______________. Force column values in one table to match any of the values in a column of another table Automatically replicate data on another server Automatically create new indexes based on query history Prevent unauthorized users from accessing data at the firls level 13. Which is not the characteristics of a view ? Consumes Disk space for data Multiple tables Multiple rows Updateable 14. RDBMS triggers are typically bound to a _____________and one or more _____________ Table,SQL statement types SQL statement type,user Column,rows User, tables 15. What relationship is resolved by an “intersecting” or “associative” entity ? Recursive Mandatory one to one Many to Many One to One 16. Select a,b,c,d from vtable where b>2 and c<4 Assuming you will execute the above query often ,changing only the values in the where clause ,what could you do to improve efficiency ? Create a database stored procedure with parameters to execute this statement Create an index on columns a&b Create a temporary table that contains the data and use triggers to maintain it Create a trigger that executes this statement and execute the trigger 17. Make a copy of file “upper” in the directory two levels up . jump –2 upper cp upper ../.. cp upper –2/ None of the above 18. Change the current directory to /usr/local/bin mv /usr/local/bin cd /usr/local/bin setdir /usr/local/bin my/usr/local/bin 19. How do you change the access permission (add group read/write) to all the files in the current directory containing the word “ cali ” in their names ? chmod g+rw * cali * setperm r+w * cali * chmod 0660 * cali * Both A and C