| | |
insert query in c#
Please support our ASP.NET advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Dec 2008
Posts: 30
Reputation:
Solved Threads: 1
sql Syntax (Toggle Plain Text)
INSERT INTO desg VALUES(" & Val(txtsno.Text) & ",'" & Trim(txtdesg.Text) & "'," & Val(txtbasic.Text) & ");
how to do in c#?
Last edited by peter_budo; Jan 21st, 2009 at 7:55 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
•
•
Join Date: Jan 2009
Posts: 2
Reputation:
Solved Threads: 1
I am unable to understand the motive the query.Give wat you want to do.
•
•
Join Date: Dec 2008
Posts: 104
Reputation:
Solved Threads: 18
sql Syntax (Toggle Plain Text)
"INSERT INTO desg VALUES(" + txtsno.TEXT + ", " + txtdesg.TEXT +", " + txtbasic.TEXT + ");";
You dont need to worry about Trim and Val functions here. Trim will happen automatically and Val is irrelevant here
Last edited by peter_budo; Jan 21st, 2009 at 7:55 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
•
•
Join Date: Sep 2007
Posts: 1,080
Reputation:
Solved Threads: 68
You should also stear away from inserting code just like that. Look into adding parameters:
This prevents SQL Injection.
ASP.NET Syntax (Toggle Plain Text)
SqlCommand comm = new SqlCommand("INSERT INTO desg VALUES (@txtsno, @txtdesg, @txtbasic)", connection); comm.Parameters.AddWithValue("@txtsno", txtsno.Text.Trim()); comm.Parameters.AddWithValue("@txtsno", txtdesg.Text.Trim()); comm.Parameters.AddWithValue("@txtsno", txtbasic.Text.Trim());
This prevents SQL Injection.
I answer pm's.
I answer questions.
I answer quickly.
I answer.
I answer questions.
I answer quickly.
I answer.
![]() |
Similar Threads
- How to insert data into database? (JSP)
- execute one insert query and two update query, in one single button click. (VB.NET)
- help with my insert query (PHP)
- need help with insert.php (PHP)
- Insert query. (ColdFusion)
- Update and insert query in one (MySQL)
Other Threads in the ASP.NET Forum
- Previous Thread: what hosting provider do you use to host ur web app?
- Next Thread: Problem in Sending Images Thru Mail
| Thread Tools | Search this Thread |
.net 2.0 3.5 ajax alltypeofvideos appliances asp asp.net beginner box browser businesslogiclayer button c# cac checkbox class commonfunctions compatible content contenttype control countryselector courier dataaccesslayer database datagrid datagridview datalist deployment development dgv dialog dropdownlist dropdownmenu dynamic dynamically edit embeddingactivexcontrol fileuploader fill findcontrol flash flv formview gridview gudi iis javascript list listbox login menu microsoft mouse mssql nameisnotdeclared news novell numerical opera order panelmasterpagebuttoncontrols problem radio ratings redirect registration relationaldatabases reportemail schoolproject search security serializesmo.table sessionvariables silverlight smoobjects software sql sql-server sqlserver2005 ssl tracking treeview validatedate validation vb.net videos vista visual-studio visualstudio vs2008 web webapplications webarchitecture webdevelopment webprogramming webservice wizard xsl






