TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Shourya Verdhan
NA
88
56.1k
how to add table name from textboxid in insert data query
Nov 5 2012 12:57 PM
Dear Friends,
i have a code where i insert values in table and
table name comes from textbox id
Code is...
SqlConnection con = new SqlConnection();
con.ConnectionString = "data source=NDTS12; initial Catalog=ndts_tm247; integrated security=true;";
con.Open();
string sql = "INSERT INTO " + txtemployeeid.Text.Trim() + "values('" + txtname.Text + "','" + txtcont.Text + "','" + txtcont2.Text + "','" + txtaddress.Text + "','" + txtmail.Text + "','" + txtsaletype.Text + "','" + txtamount.Text + "','" + dateTimePicker1.Text + "','" + txtissue.Text + "','" + txtstatus.Text + "','" + txttechname.Text + "','" + txtos.Text + "','" + txttvid.Text + "','" + txttvpw + "','" + txtdiscription.Text + "' )"; sql += ")";
SqlCommand cmd = new SqlCommand(sql, con);
cmd.ExecuteNonQuery();
con.Close();
But this code Generate an exception new
"' )"; sql += ")";
any one can tell
AS SOON AS POSIBLE
me where is the problem in this code
my email id is
[email protected]
Reply
Answers (
2
)
How to make treeview of file and folder in server in FTP Client ?
How put image in listview from database with photo id , name, date of birth