IPB

Career Guidance | Technical Jobs | Walkin Interview & Job Fairs | Fresher Jobs

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
Please help me in .NET, I am a fresher
user_Prachi_*
post May 30 2008, 07:12 PM
Post #1





Guests






Hi friends,

I am a fresher B.Tech (CS) working as trainee. I have this problem:

I'm trying to insert a record into database that has an apostrophe. When I build the SQL string it generates a syntax error in the INSERT command. How can I insert a record that has an apostrophe in some fields?

If anyone can help me then post your phone number here. I will call you.

Thanks in advance. (Being a girl, I cannot post my phone number here. Other girls who want to help me may write me a personal message)

Prachi
Go to the top of the page
 
+Quote Post
user_Gourav Kanthed_*
post May 31 2008, 07:52 AM
Post #2





Guests






QUOTE (Prachi @ May 30 2008, 07:12 PM) *
Hi friends,

I am a fresher B.Tech (CS) working as trainee. I have this problem:

I'm trying to insert a record into database that has an apostrophe. When I build the SQL string it generates a syntax error in the INSERT command. How can I insert a record that has an apostrophe in some fields?

If anyone can help me then post your phone number here. I will call you.

Thanks in advance. (Being a girl, I cannot post my phone number here. Other girls who want to help me may write me a personal message)

Prachi
Go to the top of the page
 
+Quote Post
user_Gourav Kanthed_*
post May 31 2008, 07:55 AM
Post #3





Guests






Hi

I am Gourav
I am a Student of SGSITS Indore and i'm pursuing MCA
I have the same problem during my major project but i solved it
it is very easy 2 solve

Call me here
9827857067
Go to the top of the page
 
+Quote Post
user_dhanesh_*
post May 31 2008, 08:07 AM
Post #4





Guests






Hi PRACHI,


I can help u solve that problem For insert query.......tell me wat query u r wriring........my no is 9975047862
Go to the top of the page
 
+Quote Post
user_Rajan_*
post Jun 1 2008, 03:44 PM
Post #5





Guests






Hi,


First give me your code then only i can tell you what is the error and how you can use that

alagurajan@gmail.com post me your code and i will help you

Regards
Rajan
Go to the top of the page
 
+Quote Post
user_Alok_*
post Jun 2 2008, 06:13 AM
Post #6





Guests






1----------------------->one main class class 1...the funtion is calling from another class 2..


class 1....

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using Oracle.DataAccess.Client ;
using budget.classes;
using budget;

namespace newDemands
{
/// <summary>
/// Summary description form mainBudget.
/// </summary>
public class usercontrol : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Button cmdcancel;
protected System.Web.UI.WebControls.Button cmdsave;
protected System.Web.UI.WebControls.Button cmddel;
protected System.Web.UI.WebControls.Button cmdok;
protected System.Web.UI.WebControls.TextBox TextBox1;
protected System.Web.UI.WebControls.Button cmdnew;
protected System.Web.UI.WebControls.TextBox txtsch;
protected System.Web.UI.WebControls.DropDownList cmbmjcd;
protected System.Web.UI.WebControls.Label lblgrant;
protected System.Web.UI.WebControls.Label lblyr;
protected System.Web.UI.WebControls.DropDownList cmbplan;
protected System.Web.UI.WebControls.TextBox txtsubject;
protected System.Web.UI.WebControls.DropDownList cmbdept;
protected System.Web.UI.WebControls.DataGrid dgdesig;
protected System.Web.UI.WebControls.TextBox txtrem;
protected System.Web.UI.WebControls.DataGrid dgobj;

protected System.Web.UI.WebControls.Label lblsch;

string yr,gcode,grant;
bool d;
protected System.Web.UI.WebControls.LinkButton LinkButton1;
protected System.Web.UI.WebControls.DropDownList schddown;
string sscript, mhcde;
protected System.Web.UI.WebControls.Label ll;

private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
yr=this.Request.QueryString["fyr"] ;
gcode=this.Request.QueryString["gcode"] ;
grant=this.Request.QueryString["grant"];
if(!this.IsPostBack)
{
try
{
cmddel.Attributes.Add("onClick","return confirm('Do you want to delete');");
lblyr.Text=this.Request.QueryString["fyr"] ;
lblgrant.Text= gcode.Trim() + "-"+ grant.Trim();

Fill.fill_obj(cmbmjcd,gcode);
}
catch{}

try
{
ll.Text=cmbmjcd.SelectedItem.Value.Trim();
mhcde=cmbmjcd.SelectedItem.Text.Trim();
Fill.fill_objscheme(schddown,mhcde);
}
catch
{
}

try
{
string str=schddown.SelectedItem.Text.Trim();
txtsch.Text= str.Substring(4);
}
catch
{
txtsch.Text="";
}


// Fill.fill_obj(cmbdept,"dept");
Fill.fill_newobj(cmbdept,gcode);


cmbdept.Items.Insert(0,"Select One");
// cmbplan.Items.Add("Plan");
// cmbplan.Items[0].Value="P";
// cmbplan.Items.Add("Non Plan");
// cmbplan.Items[1].Value="NP";
cmdsave.Enabled=false;
cmddel.Enabled=false;
txtsch.Enabled=false;
cmbdept.Enabled=false;
cmbmjcd.Enabled=false;
cmdnew.Enabled=true;
cmdok.Enabled=false;

if (this.Request.QueryString["flagset"]=="1")
{
string mjcd,dept;
dept=this.Request.QueryString["deptcode"];
mjcd=this.Request.QueryString["schcode"];
txtsch.Text=mjcd.Trim().Substring(4);
mjcd=mjcd.Trim().Substring(0,4);
cmbmjcd.SelectedIndex=cmbmjcd.Items.IndexOf(cmbmjcd.Items.FindByText(mjcd));
cmbdept.SelectedIndex=cmbdept.Items.IndexOf(cmbdept.Items.FindByValue(this.Reque
st.QueryString["deptcode"]));
setdata();
}
}
}


#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.LinkButton1.Click += new System.EventHandler(this.LinkButton1_Click);
this.cmbmjcd.SelectedIndexChanged += new System.EventHandler(this.cmbmjcd_SelectedIndexChanged);
this.cmdok.Click += new System.EventHandler(this.cmdok_Click);
this.schddown.SelectedIndexChanged += new System.EventHandler(this.schddown_SelectedIndexChanged);
this.cmbplan.SelectedIndexChanged += new System.EventHandler(this.cmbplan_SelectedIndexChanged);
this.dgdesig.SelectedIndexChanged += new System.EventHandler(this.dgdesig_SelectedIndexChanged);
this.dgobj.ItemCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.dgobj_ItemCommand);
this.dgobj.CancelCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.dgobj_CancelCommand);
this.dgobj.EditCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.dgobj_EditCommand);
this.dgobj.UpdateCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.dgobj_UpdateCommand);
this.dgobj.DeleteCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.dgobj_DeleteCommand);
this.dgobj.ItemDataBound += new System.Web.UI.WebControls.DataGridItemEventHandler(this.dgobj_ItemDataBound);
this.dgobj.SelectedIndexChanged += new System.EventHandler(this.dgobj_SelectedIndexChanged);
this.cmdsave.Click += new System.EventHandler(this.cmdsave_Click);
this.cmdnew.Click += new System.EventHandler(this.cmdnew_Click);
this.cmddel.Click += new System.EventHandler(this.cmddel_Click);
this.cmdcancel.Click += new System.EventHandler(this.cmdcancel_Click);
this.Load += new System.EventHandler(this.Page_Load);

}
#endregion

private void cmdok_Click(object sender, System.EventArgs e)
{
if(cmbdept.SelectedIndex!=0)
{
d=classchk.ConvertToInt(txtsch.Text.Trim());
if (txtsch.Text.Trim()!="")
{
d=classchk.ConvertToInt(txtsch.Text.Trim());
if(!d)
{
sscript="<script language=javascript >alert('Scheme Code Has to be a NUMERIC String!')</script>";
RegisterStartupScript("ERROR!",sscript);
return;
}
}
if (txtsch.Text.Trim().Length<9)
this.Response.Redirect("display1.aspx?flag=New&schcode="+(cmbmjcd.SelectedItem.Text.Trim()+txtsch.Text.Trim())+"&gcode="+gcode+"&fyr="+yr+"&grant="+grant.Trim()+"&deptcode="+cmbdept.SelectedValue.Trim());
// {
// sscript="<script language=javascript >alert('Enter the Full Code!')</script>"; RegisterStartupScript("ERROR!",sscript);
// return;
// }
else
{
dgobj.Visible=true;
dgdesig.Visible=true;
//fillddpay();

setdata();
}
}
}
private void cmdsave_Click(object sender, System.EventArgs e)
{

ND newd=new ND(gcode,(cmbmjcd.SelectedItem.Text.Trim()+txtsch.Text.Trim()),yr,Session["userid"].ToString());
//ND newd=new ND();
if (cmdsave.Text=="Save")
{
newd.insert(txtrem.Text.Trim(),txtsubject.Text.Trim(),cmbplan.SelectedItem.Value
.Trim(),cmbdept.SelectedItem.Value.Trim(),"main");

}
else if (cmdsave.Text=="Update")
{
newd.updatemain(txtrem.Text.Trim(),txtsubject.Text.Trim(),cmbplan.SelectedItem.V
alue.Trim(),cmbdept.SelectedItem.Value);
}

newd.blank(cmbdept,lblsch,cmbplan,txtsubject,txtrem);
newd.fill_grid(dgobj,gcode,(cmbmjcd.SelectedItem.Text.Trim()+txtsch.Text.Trim())
,cmbdept.SelectedItem.Value,"obj");
newd.fill_grid(dgdesig,gcode,(cmbmjcd.SelectedItem.Text.Trim()+txtsch.Text.Trim(
)),cmbdept.SelectedItem.Value,"desig");
cmbdept.Enabled=true;
cmdsave.Enabled=false;
cmdnew.Enabled=true;
cmddel.Enabled=false;
cmdok.Enabled=false;



}


private void setdata()
{
// Setadata starts here
ND m1=new ND(gcode,(cmbmjcd.SelectedItem.Text.Trim()+txtsch.Text.Trim()),yr,Session["userid"].ToString());
//m1.Getdata((cmbmjcd.SelectedItem.Text.Trim()+submj.SelectedItem.Text.Trim()+mino
r.SelectedItem.Text.Trim()+detail.SelectedItem.Text.Trim()+subdetail.SelectedIte
m
.Text.Trim()),cmbdept.SelectedItem.Value);
m1.Getdata((cmbmjcd.SelectedItem.Text.Trim()+txtsch.Text.Trim()),cmbdept.Selecte
dItem.Value);
m1.fill_grid(dgobj,gcode,(cmbmjcd.SelectedItem.Text.Trim()+txtsch.Text.Trim()),c
mbdept.SelectedItem.Value,"obj");
m1.fill_grid(dgdesig,gcode,(cmbmjcd.SelectedItem.Text.Trim()+txtsch.Text.Trim())
,cmbdept.SelectedItem.Value,"desig");

if (m1.schflag=="0")
{
if (Session["status"].ToString().Trim()=="True")
{
sscript="<script language=javascript>if (confirm('Do you want to create this scheme')){window.open('../masters/master.aspx?guestid=t',status='yes')};</script>";
RegisterStartupScript("Message",sscript);

}
lblsch.Text=m1.schname.ToString();
txtsch.Enabled=true;
cmbdept.Enabled=true;
cmbmjcd.Enabled=true;
cmdsave.Enabled=false;
cmdsave.Text="Save";
cmdnew.Enabled=false;
cmddel.Enabled=false;
cmdok.Enabled=true;
}
else
{
if (m1.flag=="0")
{
cmbdept.Enabled=true;
txtsch.Enabled=false;
cmbdept.Enabled=false;
cmbmjcd.Enabled=false;
cmdsave.Enabled=true;
cmdsave.Text="Save";
cmdnew.Enabled=false;
cmddel.Enabled=true;
cmdok.Enabled=false;

}
else
{
cmbdept.Enabled=false;
txtsch.Enabled=false;
cmbmjcd.Enabled=false;
cmdsave.Enabled=true;
cmdsave.Text="Update";
cmdnew.Enabled=false;
cmddel.Enabled=true;
cmdok.Enabled=true;

}
lblsch.Text=m1.schname;
cmbplan.SelectedIndex=cmbplan.Items.IndexOf(cmbplan.Items.FindByValue(m1.planfla
g));
txtrem.Text=m1.remark;
txtsubject.Text=m1.subject;

}

}// Setdata starts here

private void cmdcancel_Click(object sender, System.EventArgs e)
{
if(txtsch.Text.Trim().Length<9 || cmbdept.SelectedIndex==0)
return;
ND newobj=new ND(gcode,(cmbmjcd.SelectedItem.Text.Trim()+txtsch.Text.Trim()),yr,Session["userid"].ToString());
newobj.checkentry(cmbdept.SelectedItem.Value);
newobj.blank(cmbdept,lblsch,cmbplan,txtsubject,txtrem);
// newobj.fill_grid(dgobj,gcode,(cmbmjcd.SelectedItem.Text.Trim()+txtsch.Text.Trim(
)),cmbdept.SelectedItem.Value,"obj");
// newobj.fill_grid(dgdesig,gcode,(cmbmjcd.SelectedItem.Text.Trim()+txtsch.Text.Tri
m()),cmbdept.SelectedItem.Value,"desig");

dgobj.Visible=false;
dgdesig.Visible=false;
cmdsave.Enabled=false;
cmdnew.Enabled=true;
cmddel.Enabled=false;
cmdok.Enabled=false;
cmbdept.SelectedIndex=0;


}
private void cmdnew_Click(object sender, System.EventArgs e)
{

cmdsave.Enabled=false;
cmdnew.Enabled=false;
cmddel.Enabled=false;
cmdok.Enabled=true;
txtsch.Enabled=true;
cmbdept.Enabled=true;
cmbmjcd.Enabled=true;
ND nd=new ND();
nd.blank(cmbdept,lblsch,cmbplan,txtsubject,txtrem);
dgobj.Visible=false;
dgdesig.Visible=false;
// nd.fill_grid(dgobj,gcode,(cmbmjcd.SelectedItem.Text.Trim()+txtsch.Text.Trim()),c
mbdept.SelectedItem.Value,"obj");
// nd.fill_grid(dgdesig,gcode,(cmbmjcd.SelectedItem.Text.Trim()+txtsch.Text.Trim())
,cmbdept.SelectedItem.Value,"desig");
//

}

private void cmddel_Click(object sender, System.EventArgs e)
{
cmddel.Attributes.Add("onClick","return confirm('Do you want to delete');");
ND nd=new ND(gcode,(cmbmjcd.SelectedItem.Text.Trim()+txtsch.Text.Trim()),yr,Session["userid"].ToString());
nd.delete(cmbdept.SelectedItem.Value);
nd.blank(cmbdept,lblsch,cmbplan,txtsubject,txtrem);
dgobj.Visible=false;
dgdesig.Visible=false;
// nd.fill_grid(dgobj,gcode,(cmbmjcd.SelectedItem.Text.Trim()+txtsch.Text.Trim()),c
mbdept.SelectedItem.Value,"obj");
// nd.fill_grid(dgdesig,gcode,(cmbmjcd.SelectedItem.Text.Trim()+txtsch.Text.Trim())
,cmbdept.SelectedItem.Value,"desig");
cmdsave.Enabled=false;
cmdsave.Text="Save";
cmdnew.Enabled=true;
cmddel.Enabled=false;
cmdok.Enabled=false;
}

private void dg_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
LinkButton ln=(LinkButton) e.Item.FindControl("lnk");
setdata();

txtsch.Enabled=false;
cmbdept.Enabled=false;
cmbmjcd.Enabled=false;
cmdsave.Text="Update";
cmdsave.Enabled=true;
cmdnew.Enabled=false;
cmddel.Enabled=true;
cmdok.Enabled=false;

}
public void dgdesig_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
try
{
DropDownList ddpay=(DropDownList) e.Item.FindControl("ddpay");
Fill.fill_pay(ddpay);
}
catch{}
}

private void dgobj_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
try
{
DropDownList d1=(DropDownList) e.Item.FindControl("cmbobj");
Fill.fill_obj(d1,"00");
}
catch{}
}

private void dgobj_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
if(e.CommandName=="Add")
{
try
{
dgobj.EditItemIndex=e.Item.ItemIndex;
DropDownList dd=(DropDownList) e.Item.FindControl("cmbobj");
TextBox y=(TextBox) e.Item.FindControl("txtvoted2");
TextBox z=(TextBox) e.Item.FindControl("txtcharged2");
if (y.Text.Trim()=="")
y.Text="0";
if (z.Text.Trim()=="")
z.Text="0";
if (!(z.Text=="" && y.Text==""))
{
ND newobj=new ND(gcode,(cmbmjcd.SelectedItem.Text.Trim()+txtsch.Text.Trim()),yr,Session["userid"].ToString());
newobj.insert(dd.SelectedItem.Text,y.Text,z.Text,cmbdept.SelectedItem.Value,"object");
newobj.fill_grid(dgobj,gcode,(cmbmjcd.SelectedItem.Text.Trim()+txtsch.Text.Trim(
)),cmbdept.SelectedItem.Value,"obj");
}
}
catch
{
}
}

}

private void dgobj_EditCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
dgobj.EditItemIndex=e.Item.ItemIndex;
new ND(gcode,(cmbmjcd.SelectedItem.Text.Trim()+txtsch.Text.Trim()),yr,Session["userid"].ToString()).fill_grid(dgobj,gcode,(cmbmjcd.SelectedItem.Text.Trim()+txtsc
h.Text.Trim()),cmbdept.SelectedItem.Value,"obj");
}

private void dgobj_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
Label x=(Label) e.Item.FindControl("objcode");
ND n=new ND(gcode,(cmbmjcd.SelectedItem.Text.Trim()+txtsch.Text.Trim()),yr,Session["userid"].ToString());
//n.delete(x.Text,cmbdept.SelectedItem.Value,"object");
n.delete(x.Text,cmbdept.SelectedItem.Value,"object");
dgobj.EditItemIndex=-1;
n.fill_grid(dgobj,gcode,(cmbmjcd.SelectedItem.Text.Trim()+txtsch.Text.Trim()),cm
bdept.SelectedItem.Value,"obj");

}

public void dgobj_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
dgobj.EditItemIndex=e.Item.ItemIndex;
Label xx=(Label) e.Item.FindControl("objcode");
TextBox y=(TextBox) e.Item.FindControl("txtvoted1");
TextBox z=(TextBox) e.Item.FindControl ("txtcharged1");
String x = xx.Text.ToString();
if (y.Text.Trim()=="")
y.Text="0";
if (z.Text.Trim()=="")
z.Text="0";
ND n=new ND(gcode,(cmbmjcd.SelectedItem.Text.Trim()+txtsch.Text.Trim()),yr,Session["userid"].ToString());
n.update(x,y.Text.Trim(),z.Text.Trim(),cmbdept.SelectedItem.Value);
dgobj.EditItemIndex=-1;
n.fill_grid(dgobj,gcode,(cmbmjcd.SelectedItem.Text.Trim()+txtsch.Text.Trim()),cm
bdept.SelectedItem.Value,"obj");
}

public void dgobj_CancelCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
dgobj.EditItemIndex=-1;
new ND(gcode,(cmbmjcd.SelectedItem.Text.Trim()+txtsch.Text.Trim()),yr,Session["userid"].ToString()).fill_grid(dgobj,gcode,(cmbmjcd.SelectedItem.Text.Trim()+txtsc
h.Text.Trim()),cmbdept.SelectedItem.Value,"obj");
}

public void dgdesig_CancelCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
dgdesig.EditItemIndex=-1;
new ND(gcode,(cmbmjcd.SelectedItem.Text.Trim()+txtsch.Text.Trim()),yr,Session["userid"].ToString()).fill_grid(dgdesig,gcode,(cmbmjcd.SelectedItem.Text.Trim()+txt
sch.Text.Trim()),cmbdept.SelectedItem.Value,"desig");
}

public void dgdesig_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
dgdesig.EditItemIndex=e.Item.ItemIndex;
ND n=new ND(gcode,(cmbmjcd.SelectedItem.Text.Trim()+txtsch.Text.Trim()),yr,Session["userid"].ToString());
Label x=(Label) e.Item.FindControl("lblsno");
n.delete(x.Text.Trim(),cmbdept.SelectedItem.Value,"desig");
dgdesig.EditItemIndex=-1;
n.fill_grid(dgdesig,gcode,(cmbmjcd.SelectedItem.Text.Trim()+txtsch.Text.Trim()),
cmbdept.SelectedItem.Value,"desig");
}

public void dgdesig_EditCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
dgdesig.EditItemIndex=e.Item.ItemIndex;
new ND(gcode,(cmbmjcd.SelectedItem.Text.Trim()+txtsch.Text.Trim()),yr,Session["userid"].ToString()).fill_grid(dgdesig,gcode,(cmbmjcd.SelectedItem.Text.Trim()+txt
sch.Text.Trim()),cmbdept.SelectedItem.Value,"desig");
}

public void dgdesig_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
dgdesig.EditItemIndex=e.Item.ItemIndex;
DropDownList ddpay=(DropDownList)e.Item.FindControl("ddpay");
Label x=(Label) e.Item.FindControl("lblsno");
TextBox y=(TextBox) e.Item.FindControl("txtdesig1");
TextBox z=(TextBox) e.Item.FindControl ("txtqty1");
if (y.Text.Trim()=="")
y.Text="0";
if (z.Text.Trim()=="")
z.Text="0";
ND n=new ND(gcode,(cmbmjcd.SelectedItem.Text.Trim()+txtsch.Text.Trim()),yr,Session["userid"].ToString());
//dgdesig.Attributes.Add("OnUpdateCommand ",y.Text ,z.Text,x.Text);
n.updatedesig(y.Text.Trim(),z.Text.Trim(),x.Text.Trim (),cmbdept.SelectedItem.Value);
dgdesig.EditItemIndex=-1;
n.fill_grid(dgdesig,gcode,(cmbmjcd.SelectedItem.Text.Trim()+txtsch.Text.Trim()),
cmbdept.SelectedItem.Value,"desig");

}

public void dgdesig_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
if(e.CommandName=="Add")
{
try
{
dgdesig.EditItemIndex=e.Item.ItemIndex;
DropDownList ddpay=(DropDownList) e.Item.FindControl("ddpay");
TextBox x=(TextBox) e.Item.FindControl("txtdesig");
TextBox y=(TextBox) e.Item.FindControl("txtqty");
if (y.Text.Trim()=="")
y.Text="0";
if (x.Text.Trim()=="")
x.Text="0";
if (!(y.Text=="" && x.Text==""))
{
ND newsub=new ND(gcode,(cmbmjcd.SelectedItem.Text.Trim()+txtsch.Text.Trim()),yr,Session["userid"].ToString());
newsub.insert(x.Text,y.Text,ddpay.SelectedItem.Value,cmbdept.SelectedItem.Value,"desig");
newsub.fill_grid(dgdesig,gcode,(cmbmjcd.SelectedItem.Text.Trim()+txtsch.Text.Tri
m()),cmbdept.SelectedItem.Value,"desig");
}
}
catch{}
}
}

private void LinkButton1_Click(object sender, System.EventArgs e)
{
Response.Redirect("newdemandMenu.aspx");
}

private void schddown_SelectedIndexChanged(object sender, System.EventArgs e)
{

string str=schddown.SelectedItem.Text.Trim();
txtsch.Text= str.Substring(4);
}

private void cmbmjcd_SelectedIndexChanged(object sender, System.EventArgs e)
{
ll.Text=cmbmjcd.SelectedItem.Value.Trim();
mhcde=cmbmjcd.SelectedItem.Text.Trim();
Fill.fill_objscheme(schddown,mhcde);
try
{
string str=schddown.SelectedItem.Text.Trim();
txtsch.Text= str.Substring(4);
}
catch
{
txtsch.Text="";
}
}

private void dgdesig_SelectedIndexChanged(object sender, System.EventArgs e)
{

}

private void cmbplan_SelectedIndexChanged(object sender, System.EventArgs e)
{

}

private void dgobj_SelectedIndexChanged(object sender, System.EventArgs e)
{

}

}
}



class 2..........................











using System;
//using System.Data.SqlClient;
using budget;
using System.Data;
using System.Web.UI.WebControls;
using Oracle.DataAccess.Client;

namespace budget
{ //name space budget begins here
/// <summary>
/// Summary description for MB.
/// </summary>
namespace classes
{ //name space classes begins here
public class ND
{
//to declare the variables
conn1 c;
OracleCommand cmd;
OracleDataAdapter da;
DataSet ds;
DateTime doe;

string str,user_ID;
string yr,grant,schcode,major,submajor,minor,detail,subdetail,addnewdetail;
public string schflag,flag,remark,subject,planflag,schname;
public ND()
{
//
// TODO: Add constructor logic here
//
doe=DateTime.Now;
yr=grant=schcode="";
major=submajor=minor=detail=subdetail=addnewdetail="";
schname="";
remark=subject=planflag="";

}
public ND(string gn,string sch,string y,string uid)
{
grant=gn.Trim();
schcode=sch.Trim();
major=sch.Trim().Substring(0,4);
submajor=sch.Trim().Substring(4,2);
minor=sch.Trim().Substring(6,3);
detail=sch.Trim().Substring(9,2);
subdetail=sch.Trim().Substring(11,2);
addnewdetail=sch.Trim().Substring(13,2);
yr=y;
user_ID=uid;
doe=DateTime.Now;
}


public void insert(string objcode_desig_rem,string vamt_qty_sub,string camt_pay_pnp,string dept, string flag )
{
c=new conn1();
cmd=new OracleCommand();
//str=doe.ToString("dd/MM/yyyy");
this.cmd.Connection=c.orcl_open();
if (flag=="object")
{
cmd.CommandText="insert into newDemandsobj values(N'" + dept.Trim() + "',N'" + grant + "',N'" + major+submajor+minor+detail+subdetail +addnewdetail +"',N'" + objcode_desig_rem + "','" + yr + "'," + Convert.ToDouble(vamt_qty_sub)+ "," + Convert.ToDouble(camt_pay_pnp) + ",N'" + user_ID + "',to_date('"+doe.ToString("dd/MM/yy")+"','DD/MM/YY'))";
this.cmd.ExecuteNonQuery();
classchk.updaterevised(grant,schcode,objcode_desig_rem,yr,user_ID);
}
else if (flag=="desig")
{
int sno;
cmd.CommandText="select count(s_no) from newDemandsSub where deptcode=N'"+dept+"' and grantcode=N'"+grant+"' and schemecode=N'"+schcode+"' and financialYear='"+yr+"'";
sno=Convert.ToInt32(cmd.ExecuteScalar())+1;
cmd.CommandText="insert into newDemandssub values(N'" + dept.Trim() + "','" + grant + "','" + schcode + "','" + yr + "',"+sno+",N'"+objcode_desig_rem+"'," + Convert.ToInt32(vamt_qty_sub.Trim())+ ",'" + camt_pay_pnp.Trim() + "','" + user_ID + "',to_date('" + doe.ToString("dd/MM/yy") + "','DD/MM/YY'))";
this.cmd.ExecuteNonQuery();
}
else if(flag=="main")
{
ds=new DataSet();
//cmd.CommandText="insert into newDemands values(N'" + dept + "',N'" + major + "',N'" + submajor + "',N'" + minor + "',N'" + detail + "',N'" + subdetail + "',N'" + grant + "',N'" + schcode + "','" + yr + "',N'" + objcode_desig_rem + "',N'" + vamt_qty_sub + "','" + camt_pay_pnp + "',N'" + user_ID + "',to_date('" + doe.ToString("dd/MM/yy") + "','DD/MM/YY'))";
cmd.CommandText="insert into newDemands values(N'" + dept + "',N'" + major + "',N'" + submajor + "',N'" + minor + "',N'" + detail + "',N'" + subdetail + "',N'" + grant + "',N'" + schcode + "','" + yr + "',N'" + objcode_desig_rem + "',N'" + vamt_qty_sub + "','" + camt_pay_pnp + "',N'" + user_ID + "',to_date('" + doe.ToString("dd/MM/yy") + "','DD/MM/YY'))";
cmd.ExecuteNonQuery();

OracleDataAdapter da=new OracleDataAdapter("select objectCode from newDemandsObj where grantcode=N'"+grant+"' and financialYear='"+yr+"' and schemecode=N'"+schcode+"' and deptcode=N'"+dept+"'",c.orcl_open());
da.Fill(ds,"obj");
for(int i=0;i< ds.Tables["obj"].Rows.Count;i++)
{
classchk.updaterevised(grant,schcode,ds.Tables["obj"].Rows[i][0].ToString(),yr,user_ID);
}
ds.Tables.Clear();
}

this.cmd.Dispose();
c.orcl_close();

}

public void updatemain(string rem,string sub,string plan,string dept)
{
c=new conn1();
cmd=new OracleCommand();
this.cmd.Connection=c.orcl_open();
str="update newDemands set Remark=N'" + rem + "',subject=N'" + sub + "',planflag='"+ plan +"',userID=N'" + user_ID + "',doe=to_date('" + doe.ToString("dd/MM/yy") + "','DD/MM/YY') where grantCode=N'" + grant + "' and schemeCode=N'" + schcode + "' and financialYear='" + yr + "' " ;
cmd.CommandText=str;
this.cmd.ExecuteNonQuery();
this.cmd.Dispose();
c.orcl_open();
}


public void update(string objcode,string vamt,string camt,string dept)
{
c=new conn1();
cmd=new OracleCommand();
this.cmd.Connection=c.orcl_open();
str="update newDemandsobj set Votedamt=" + Convert.ToDouble(vamt) + ",Chargedamt=" + Convert.ToDouble(camt) + ",userID=N'" + user_ID + "',doe=to_date('" + doe.ToString("dd/MM/yy") + "','DD/MM/YY') where grantCode=N'" + grant + "' and schemeCode=N'" + schcode + "' and financialYear='" + yr + "' and objectCode=N'" + objcode + "' and deptcode=N'"+dept+"'" ;
cmd.CommandText=str;
this.cmd.ExecuteNonQuery();
this.cmd.Dispose();
c.orcl_close();
classchk.updaterevised(grant,schcode,objcode,yr,user_ID);
}



public void update(string desig,string qty,string pay,string sno,string dept)
{
c=new conn1();
cmd=new OracleCommand();
this.cmd.Connection=c.orcl_open();
str="update newDemandsSub set designation=N'" + desig + "',qty=" + Convert.ToInt32(qty.Trim()) + ",payscale=N'" + pay + "',userID=N'" + user_ID + "',doe=to_date('" + doe.ToString("dd/MM/yy") + "','DD/MM/YY') where grantCode=N'" + grant + "' and schemeCode=N'" + schcode + "' and financialYear='" + yr + "' and s_no='" + Convert.ToInt16(sno.Trim()) + "' and deptcode=N'"+dept+"'" ;
cmd.CommandText=str;
this.cmd.ExecuteNonQuery();
this.cmd.Dispose();
c.orcl_close();
}
//**************pay
public void updatedesig(string desig,string qty,string sno,string dept)
{
c=new conn1();
cmd=new OracleCommand();
this.cmd.Connection=c.orcl_open();
//str="update newDemandsSub set designation=N'" + desig + "',qty=" + Convert.ToInt32(qty.Trim()) + ",userID=N'" + user_ID + "'doe=to_date('" + doe.ToString("dd/MM/yy") + "','') where grantCode=N'" + grant + "' and schemeCode=N'" + schcode + "' and financialYear='" + yr + "' and s_no='" + Convert.ToInt16(sno.Trim()) + "' and deptcode=N'"+dept+"'" ;
str="update newDemandsSub set designation=N'" + desig + "',qty=" + Convert.ToInt32(qty.Trim()) + ",userID=N'" + user_ID + "',doe=to_date('" + doe.ToString("dd/MM/yy") + "','DD/MM/YY') where grantCode=N'" + grant + "' and schemeCode=N'" + schcode + "' and financialYear='" + yr + "' and s_no='" + Convert.ToInt16(sno.Trim()) + "' and deptcode=N'"+dept+"'" ;
cmd.CommandText=str;
this.cmd.ExecuteNonQuery();
this.cmd.Dispose();
c.orcl_close();
}

public void delete(string code,string dept,string flag)
{
c=new conn1();
cmd=new OracleCommand();
this.cmd.Connection=c.orcl_open();
if (flag=="object")
{

cmd.CommandText="Delete from newDemandsObj where grantCode=N'" + grant + "' and schemeCode=N'" + schcode + "' and financialYear='" + yr + "' and objectCode=N'" + code + "'" ;
this.cmd.ExecuteNonQuery();
classchk.updaterevised(grant,schcode,code,yr,user_ID);
}
else if (flag=="desig")
{
this.cmd.CommandText="Delete from newDemandsSub where grantCode=N'" + grant + "' and schemeCode=N'" + schcode + "' and financialYear='" + yr + "' and s_no=" + code + " " ;
this.cmd.ExecuteNonQuery();
cmd.CommandText="update newDemandsSub set s_no=s_no-1 where s_no>"+code+" and grantCode=N'" + grant + "' and schemeCode=N'" + schcode + "' and financialYear='" + yr + "'" ;
this.cmd.ExecuteNonQuery();
}
this.cmd.Dispose();
c.orcl_close();
}

public void delete(string dept)
{
c=new conn1();
cmd=new OracleCommand();
ds=new DataSet();


this.cmd.Connection=c.orcl_open();
cmd.CommandText="delete from newDemands where grantcode=N'"+grant+"' and financialYear='"+yr+"' and schemecode=N'"+schcode+"' ";
this.cmd.ExecuteNonQuery();


OracleDataAdapter da=new OracleDataAdapter("select objectCode from newDemandsObj where grantcode=N'"+grant+"' and financialYear='"+yr+"' and schemecode=N'"+schcode+"' and deptcode=N'"+dept+"'",c.orcl_open());
da.Fill(ds,"obj");
cmd.CommandText="delete from newDemandsObj where grantcode=N'"+grant+"' and financialYear='"+yr+"' and schemecode=N'"+schcode+"' ";
this.cmd.ExecuteNonQuery();
for(int i=0;i< ds.Tables["obj"].Rows.Count;i++)
{
classchk.updaterevised(grant,schcode,ds.Tables["obj"].Rows[i][0].ToString(),yr,user_ID);
}
ds.Tables.Clear();

cmd.CommandText="delete from newDemandsSub where grantcode=N'"+grant+"' and financialYear='"+yr+"' and schemecode=N'"+schcode+"'";
this.cmd.ExecuteNonQuery();
this.cmd.Dispose();
c.orcl_open();


}

// public void fill_obj(DropDownList cmb,string gcode)
// {
// c=new conn1();
// ds=new DataSet();
// cmd=new OracleCommand();
// cmd.Connection=c.orcl_open();
// if (gcode=="00")
// cmd.CommandText="select deptNameHindi,deptCode from Department";
// else if (gcode=="obj")
// cmd.CommandText="select objectCode,objectNameHindi from stdObject";
// else
// cmd.CommandText="select majorHeadCode,majorHeadCode from majorHead where grantcode=N'"+gcode.Trim()+"'";
// da=new OracleDataAdapter(cmd);
// da.Fill(ds,"temp");
// cmb.DataTextField=ds.Tables["temp"].Columns[0].ToString();
// cmb.DataValueField=ds.Tables["temp"].Columns[1].ToString();
// cmb.DataSource=ds.Tables["temp"];
// cmb.DataBind();
// ds.Tables.Clear();
// c.orcl_close();
// }

public void Getdata(string schcode,string dept)
{
c=new conn1();
ds=new DataSet();
string str=schcode.Trim().Substring(0,13);
str="select schNameHindi from subdetailhead where schemecode=N'" + str + "'" ;
da=new OracleDataAdapter(str,c.orcl_open());
da.Fill(ds,"scheme");
if ((ds.Tables["scheme"].Rows.Count==0))
{
schflag="0";
schname="No Scheme Found Corresponding to this Scheme Code";

}
else
{
schflag="1";
schname=ds.Tables["scheme"].Rows[0][0].ToString();
}


//str="select remark,subject,planflag from newDemands where grantCode=N'" + grant + "' and schemeCode=N'" + schcode + "' and financialYear='" + yr + "' and deptCode=N'" + dept + "'" ;
str="select remark,subject,planflag from newDemands where grantCode=N'" + grant + "' and schemeCode=N'" + schcode + "' and financialYear='" + yr + "'" ;
da=new OracleDataAdapter(str,c.orcl_open());
da.Fill(ds,"Newdemands");

if ((ds.Tables["Newdemands"].Rows.Count==0))
{
flag="0";
}
else
{
flag="1";
remark=ds.Tables["NewDemands"].Rows[0][0].ToString().Trim();
subject=ds.Tables["NewDemands"].Rows[0][1].ToString().Trim();
planflag=ds.Tables["NewDemands"].Rows[0][2].ToString().Trim();
}
c.orcl_close();
}

public void fill_grid(DataGrid dg,string gcode,string sch,string dept,string flag)
{ // Fill_grid starts here
ds=new DataSet();
conn1 c=new conn1();
if(flag=="obj")
//str="Select a.objectCode,b.objectNameHindi,a.votedAmt,a.chargedAmt from NewDemandsObj a,stdobject b where a.objectCode=b.objectCode and a.financialYear='" + yr + "' and a.grantCode=N'" + gcode + "' and a.schemeCode=N'" + sch + "' and a.deptCode=N'"+dept+"' ";
str="Select a.objectCode,b.objectNameHindi,a.votedAmt,a.chargedAmt from NewDemandsObj a,stdobject b where a.objectCode=b.objectCode and a.financialYear='" + yr + "' and a.grantCode=N'" + gcode + "' and a.schemeCode=N'" + sch + "' order by a.objectcode";

else
//str="Select a.s_no,a.designation,a.qty,a.payscale from NewDemandsSub a where a.financialYear='"+yr+"' and a.grantCode=N'"+gcode+"' and a.schemeCode=N'"+sch+"' and a.deptCode=N'"+dept+"'";
str="Select a.s_no,a.designation,a.qty,a.payscale from NewDemandsSub a where a.financialYear='"+yr+"' and a.grantCode=N'"+gcode+"' and a.schemeCode=N'"+sch+"'";
da=new OracleDataAdapter(str,c.orcl_open());
da.Fill(ds,"temp");
dg.DataSource=ds;
dg.DataBind();
c.orcl_close();
} // Fill_grid starts here


public void blank(DropDownList l1,Label lbl,DropDownList l2,TextBox t1,TextBox t2 )
{

t1.Text=t2.Text=lbl.Text="";
l1.SelectedIndex=0;
l2.SelectedIndex=0;


}
public void checkentry(string dept)
{
c=new conn1();
cmd=new OracleCommand();
ds=new DataSet();
this.cmd.Connection=c.orcl_open();
cmd.CommandText="select count(deptcode) from newDemands where grantcode=N'"+grant+"' and financialYear='"+yr+"' and schemecode=N'"+schcode+"' and deptcode=N'"+dept+"'";
int n;
n=Convert.ToInt32(cmd.ExecuteScalar());
if (n==0)
{
OracleDataAdapter da=new OracleDataAdapter("select objectCode from newDemandsObj where grantcode=N'"+grant+"' and financialYear='"+yr+"' and schemecode=N'"+schcode+"' and deptcode=N'"+dept+"'",c.orcl_open());
da.Fill(ds,"obj");
for(int i=0;i< ds.Tables["obj"].Rows.Count;i++)
{
classchk.updaterevised(grant,schcode,ds.Tables["obj"].Rows[i][0].ToString(),yr,user_ID);
}
ds.Tables.Clear();

cmd.CommandText="delete from newDemandsObj where grantcode=N'"+grant+"' and financialYear='"+yr+"' and schemecode=N'"+schcode+"' and deptcode=N'"+dept+"'";
cmd.ExecuteNonQuery();
cmd.CommandText="delete from newDemandsSub where grantcode=N'"+grant+"' and financialYear='"+yr+"' and schemecode=N'"+schcode+"' and deptcode=N'"+dept+"'";
cmd.ExecuteNonQuery();
}


}
} // name space MB ends here
} // name space classes ends here
} // name space budget end here














this can solve your porblem!!!!

Regrads
Alok
Go to the top of the page
 
+Quote Post
admin
post Jun 2 2008, 05:34 PM
Post #7


Administrator
***

Group: Root Admin
Posts: 51,923
Joined: 9-May 08
Member No.: 1



So prachi, I hope alok have the solution.


--------------------
-------------------------------------------------------------------------------------------
AdGuru.org is a current happenings discussions board for Information Technology, News and Fun
visit: www.adguru.org
Go to the top of the page
 
+Quote Post
user_Prachi_*
post Jun 3 2008, 05:12 AM
Post #8





Guests






Dear all,

I am looking for a simple solution. The above solution if complicated.

Please help.

Regards
Prachi
Go to the top of the page
 
+Quote Post
theboss
post Jun 4 2008, 06:33 AM
Post #9


Newbie
*

Group: Members
Posts: 1
Joined: 4-June 08
From: hyderabad
Member No.: 701



QUOTE (Prachi @ May 30 2008, 07:12 PM) *
Hi friends,

I am a fresher B.Tech (CS) working as trainee. I have this problem:

I'm trying to insert a record into database that has an apostrophe. When I build the SQL string it generates a syntax error in the INSERT command. How can I insert a record that has an apostrophe in some fields?

If anyone can help me then post your phone number here. I will call you.

Thanks in advance. (Being a girl, I cannot post my phone number here. Other girls who want to help me may write me a personal message)

Prachi
Go to the top of the page
 
+Quote Post
user_Ajay_*
post Jun 4 2008, 09:22 AM
Post #10





Guests






Hi prachi and all,
just use textbox_name.Text.Replace("'", "''") then it will work fine, (just replace one apostrophe with two apostrophe)

i think there is no need of phone number............ rolleyes.gif

and my email romio420_420@yahoo.co.in
Go to the top of the page
 
+Quote Post
user_Akhil Tyagi_*
post Jun 4 2008, 09:53 AM
Post #11





Guests






Hi thr..?
You plz try this out..
take a local variable of char type say: char a;
then initialize it with your apostrophe like ;
char a = "'";
that is apostrophe sandwitched between 2 quotes.
that's it now whe you want to enter the data to ur database just concatenate this variable and fire the query ....
just like my example...
string str="My name is Akhil Tyagi, and Who";
atring a=" 's gonna work with me";
and now just concatenate them .. with command...
and if stil it didnt work then make a add one textbox with hidden property, put value as apostrophe in it and just fetch out this value at the time of ur query ... and add that to ur query ..
hope this might solve ur problem....
if in case it didnt help u out then.. its really a serious prob . and for that u can mail me at itsakhiltyagi4u@gmail.com with ur sample code .. only if u wish to..
bbye
Go to the top of the page
 
+Quote Post
user_pravin_*
post Jun 4 2008, 04:09 PM
Post #12





Guests






just add @ st starting of ur query or use escape character ...
Go to the top of the page
 
+Quote Post
user_Guest_JayaKumar_*_*
post Jun 5 2008, 05:13 AM
Post #13





Guests






QUOTE (Prachi @ Jun 3 2008, 05:12 AM) *
Dear all,

I am looking for a simple solution. The above solution if complicated.

Please help.

Regards
Prachi



Pls Post U r Code.. so that only i can tell u a solution...
Go to the top of the page
 
+Quote Post
user_Mohd Arshad_*
post Jun 5 2008, 06:49 AM
Post #14





Guests






QUOTE (Prachi @ May 30 2008, 07:12 PM) *
Hi friends,

I am a fresher B.Tech (CS) working as trainee. I have this problem:

I'm trying to insert a record into database that has an apostrophe. When I build the SQL string it generates a syntax error in the INSERT command. How can I insert a record that has an apostrophe in some fields?

If anyone can help me then post your phone number here. I will call you.

Thanks in advance. (Being a girl, I cannot post my phone number here. Other girls who want to help me may write me a personal message)

Prachi



Hi...Prachi,

The simplest solution for your problem is to use SQL Server's CHAR(<ascii value>) function to generate single quote.

e.g.

Let there is a table EMPLOYEE with singe field E_NAME, you want to insert value JOHN'S in this table, do it this way....

insert into EMPLOYEE values ('JOHN'+char(39)+'S')

Remember 39 is ascii value for apostrophe. And we can concatenate strings using + sign.

Hope you'll find it help full.

Mohd Arshad
9718441975
www.m-arshad.co.cc
Go to the top of the page
 
+Quote Post
khaleelahmed00
post Jun 5 2008, 07:55 AM
Post #15


Newbie
*

Group: Members
Posts: 1
Joined: 5-June 08
Member No.: 810



Hi..

this will help you to solve your problem...
string str2 = str1.Replace("'", "''");
That is replace the string which has an apostrophe with two of them..
hope you got it.


any more queries mail to khaleelahmed00@gmail.com
Go to the top of the page
 
+Quote Post
user_kalyan.k_*
post Jun 5 2008, 01:05 PM
Post #16





Guests






QUOTE (Prachi @ May 30 2008, 07:12 PM) *
Hi friends,

I am a fresher B.Tech (CS) working as trainee. I have this problem:

I'm trying to insert a record into database that has an apostrophe. When I build the SQL string it generates a syntax error in the INSERT command. How can I insert a record that has an apostrophe in some fields?

If anyone can help me then post your phone number here. I will call you.

Thanks in advance. (Being a girl, I cannot post my phone number here. Other girls who want to help me may write me a personal message)

Prachi
Go to the top of the page
 
+Quote Post
user_kalyan.k_*
post Jun 5 2008, 01:12 PM
Post #17





Guests






QUOTE (Prachi @ May 30 2008, 07:12 PM) *
Hi friends,

I am a fresher B.Tech (CS) working as trainee. I have this problem:

I'm trying to insert a record into database that has an apostrophe. When I build the SQL string it generates a syntax error in the INSERT command. How can I insert a record that has an apostrophe in some fields?

If anyone can help me then post your phone number here. I will call you.

Thanks in advance. (Being a girl, I cannot post my phone number here. Other girls who want to help me may write me a personal message)

Prachi



Try to denote the field wit varchar in SQL so that any data can be inserted
Go to the top of the page
 
+Quote Post
user_Manish_*
post Jun 6 2008, 04:34 AM
Post #18





Guests






QUOTE (Prachi @ May 30 2008, 07:12 PM) *
Hi friends,

I am a fresher B.Tech (CS) working as trainee. I have this problem:

I'm trying to insert a record into database that has an apostrophe. When I build the SQL string it generates a syntax error in the INSERT command. How can I insert a record that has an apostrophe in some fields?

If anyone can help me then post your phone number here. I will call you.

Thanks in advance. (Being a girl, I cannot post my phone number here. Other girls who want to help me may write me a personal message)

Prachi


Hi Prachi

I think that the Apostrophe is there in some of the string(varchar) field. So what is happening here is.... apostrophe is being considered as the termination of the string(varchar) and the next item will not be saved. So to AVOID this problem.. use 2 APOSTROPHE INSTEAD OF 1. REMEMBER.... 2 APOSTROPHE DOES NOT MEAN DOUBLE QUOTE(WHICH WE GET BY PRESSING (SHIFT + '). 2 APOSTROPHE MEANS 2 TIMES APOSTROPHE.

For example : If I have to write manis'h in employee table for name then use this query ie insert into employee (id, name) values (7, 'manis''h')

This will surely sort your problem.

Even if there is some problem you can mail me at manishonline83@gmail.com

With Regards
Manish
Go to the top of the page
 
+Quote Post
user_lalitesh_*
post Jun 19 2008, 01:06 PM
Post #19





Guests






Hi, prachi
your prob may be solved by using this query

insert into tablename values(char(39)+'string');

if further any queries then you can contact me through my id

kumarlalitesh@gmail.com
Go to the top of the page
 
+Quote Post

Fast ReplyReply to this topicStart new topic
Tags

1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 12th March 2010 - 11:41 PM