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
Jes Sie
742
1.2k
282.1k
Passing 2 parameters but only 1 from sql server DB
Mar 28 2017 3:51 AM
Is it possible to pass 2 parameters in web application but only 1 parameter comes from sql server db? The other parameter comes from a pre set dropdownlist. If it's possible, how to do it? This is what I have in mind but not sure if it is correct.
public
static
List<CompulsoryTable> GetCompulsoryCoverage(
string
vehicleType,
string
Option)
{
List<CompulsoryTable> getVehicleType =
new
List<CompulsoryTable>();
using
(SqlConnection con = DBConnection.GetDbCon())
{
SqlCommand cmd =
new
SqlCommand(
"select * from tblCompulsoryTable where VehicleType = @VehicleType"
, con);
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue(
"@VehicleType"
, vehicleType);
cmd.Parameters.AddWithValue(
"@CompulsoryOptions"
, Option);
con.Open();
SqlDataReader rdr = cmd.ExecuteReader();
while
(rdr.Read())
{
CompulsoryTable Vehicles =
new
CompulsoryTable();
Vehicles.VehicleType = rdr[
"VehicleType"
].ToString();
getVehicleType.Add(Vehicles);
}
}
return
getVehicleType;
}
Reply
Answers (
4
)
Unable to find the requested .Net Framework Data Provider.
How to use jquery calendar in asp.net.