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
Ali Ashiq
NA
61
32.4k
Values inserted by user and get records from data base
Feb 8 2014 5:18 AM
Hi, i have a two fields and want to get values from user and get products from data base my scenario is i have two text fields and on search button when a user press search button query pass to the database and get products against that query.
Here is my WebMethod which will return products against user enter amount and person. Now same i want to do on my website please help me
public DataSet Restaurant(decimal amount, decimal persons)
{
decimal price = amount / persons ;
DataSet result = null;
const string SQL_COMMAND_TEXT = "SELECT Product_Name,Product_Price FROM Table1234 WHERE Product_Price <= @price";
using (SqlConnection connection = Class1.GetConnection())
{
connection.Open();
using (SqlCommand command = new SqlCommand(SQL_COMMAND_TEXT, connection))
{
command.Parameters.Add("@Rst_Name", SqlDbType.NVarChar);
command.Parameters.Add("@Persons", SqlDbType.NVarChar);
command.Parameters.Add("@price", SqlDbType.SmallMoney);
command.Parameters["@Rst_Name"].Value = amount;
command.Parameters["@persons"].Value = persons;
command.Parameters["@price"].Value = price;
using (SqlDataAdapter dataAdapter = new SqlDataAdapter(command))
{
result = new DataSet();
dataAdapter.Fill(result);
}
}
}
return result;
}
Reply
Answers (
7
)
Create runtime dropdown list in Asp.net
How to Incorporate SSRS Report using MVC 4.0 with Razor Engi