Last post Jan 04, 2017 08:57 AM by Zhi Lv - MSFT
Jan 03, 2017 12:53 PM|hoitm|LINK
i want to create dynamic report and store save in sql server.
example here http://stackoverflow.com/questions/27682580/mvc-how-to-populate-dropdownlist-from-sql-query-stored-in-a-db-field#_=_
how to create report with dynamic parameter like this artical.
anyone suggest me how to approad that technical
Jan 03, 2017 12:56 PM|hoitm|LINK
here report table(how many table we create)
Jan 04, 2017 02:13 AM|hoitm|LINK
anyone suggest me how to do this, thanks so much.
Jan 04, 2017 06:44 AM|Zhi Lv - MSFT|LINK
How to populate dropdownlist from sql query stored in a db field
From your description, I suggest you could refer to the following steps:
1: Using Ado.net or LINQ to get the sql statement.
2: If you want to execute native raw SQL query against the database using EF DBContext, you could refer to the following code:
using (var ctx = new SchoolDBEntities())
var studentList = ctx.Students.SqlQuery("Select * from Student").ToList<Student>();
More details, see:
3: After get the records from the database, you could use ViewBag or ViewData to bind the DropDownList. Please refer to the following links:
Jan 04, 2017 08:13 AM|hoitm|LINK
thanks for replay. i want to add sql query into colum of table and excute sql from table, how to do this in mvc or webforms thanks
Jan 04, 2017 08:57 AM|Zhi Lv - MSFT|LINK
i want to add sql query into colum of table
First, in the database, you could add a nvarchar() type column to store the sql query statement.
Then, you could refer to the following links to insert/select value into database:
using ado.net in webform application
using EF in MVC:
excute sql from table
You could execute the select statement to query the database, and get the sql query, then, according the sql query to use the
SqlQuery method or ado.net method to query the database and get the records.