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
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Binding Dropdownlist and Perform Save Operation
Sandeep Kumar
Dec 30
2015
Code
1.9
k
0
1
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
Stored Procedure.rar
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Web;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
System.Data;
using
System.Data.SqlClient;
Namespace Stored
SqlConnection con =
new
SqlConnection(
"Integrated Security=true;Initial Catalog=TableName;Data source=."
);
SqlCommand cmd;
SqlParameter sp;
Private
void
Page_Load();
{}
Private
void
btn_Save(Object Sender, Event Argts e)
{
con.Open();
cmd =
new
SqlCommand(
"PrcData"
, con);
//PrcData is stored procedure Name
cmd.CommandType = CommandType.StoredProcedure;
sp =
new
SqlParameter(
"@p1"
, SqlDBType.
int
);
p1.Value = TxtEid.Text;
cmd.parameter.Add(sp);
sp =
new
SqlParameter(
"@p2"
, SqldbType.Varchar, 20)
sp.Value = txtEName.Text;
cmd.parameter.Add(sp);
sp =
new
SqlParameter(
"@p3"
, Dropdownlist1.selectedItem.Value);
sp.Value = txtDID.Text;
cmd.Parameter.Add(sp);
con.Close();
lblDisplay.Text(
"Details has Saved Successfully "
);
}
Save Operation
stored procedure
Binding Dropdownlist