Click here to Skip to main content
15,896,201 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hai,

am using asp:content pages binded dropdown list selected item unable to insert in DB

but when am using under Default.aspx with HTML code under it is working properly

can i get any help regarding this.

SQL
con.Open();
            qry = "insert into dtdc_ititemmaster (Machine_Sr_no,Model,Type,Make,AMC_Date,Warranty_Date,Dept,User_Name,Identification,IP,Configuration,AMC_Vendor,PO_NO,PO_Date,Remarks) values('" +txtmachineno.Text+ "','" + txtmodel.Text  + "','" + droptype.SelectedItem + "','" + txtmake.Text + "','" + txtamc.Text+ "','" + txtwrrwnty.Text + "','" +dropdept.SelectedItem + "','"+txtuname.Text+"','"+txtidenty.Text+"','"+txtipadd.Text+"','"+txtconfg.Text+"','"+txtamcvndr.Text+"','"+txtpono.Text+"','"+txtpodate.Text+"','"+txtremark.Text+"')";
            SqlCommand cmd = new SqlCommand(qry, con);
            cmd.ExecuteNonQuery();
Posted

1 solution

Irrespective of your question, Do you know that this implementation is susceptible of SQL Injection[^]?

I would suggest you to rather use Stored Procedure[^] or Parameterized Queries[^] in SQL.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900