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
Sulieman Alkatib
NA
56
4.7k
insert values into table using dataset and dropdownlist
May 24 2017 12:05 PM
Hi
I just finish dataSet codes as followed:
SELECT date_E, adminname
FROM event
WHERE (
ID
= ?)
I have a dropDownList that allows user to select
ID
only and the system will insert date_E and adminname into that table
what is the proper code to get date_e and adminname to use it in my function
protected void Button
1
_Click(object sender, EventArgs e)
{
string id = DropDownList
1
.SelectedValue;
OleDbConnection con = new OleDbConnection(
"connectionstring"
);
try
{
OleDbCommand cmd = con.CreateCommand();
con.Open();
cmd.CommandText =
"Insert into customer Values('"
+ Session[
"UserName"
] +
"','"
+ ????? +
"' , '"
+ DropDownList
1
.SelectedValue +
"' , '"
+ ????? +
"')"
;
cmd.Connection = con;
cmd.ExecuteNonQuery();
con.Close();
Label
3
.Text =
"Registered successfully"
;
}
catch (Exception)
{
Label
3
.Text =
"database connection problem"
;
}
}
Reply
Answers (
5
)
Age after 10 years
C# combobox web link in visual studio 2015