ParamQuery grid support forum
General Category => Help for ParamQuery Pro => Topic started by: marco.fuhrmann on February 25, 2016, 03:20:02 pm
-
I want to use pqgrid in a c# .net-application.
I didn`t found a way to connect to a MS SQL Database in the Demos (for example Remote Paging). Where I have to configure the connection to the Database(s)?
Normally i use something like this:
string source = @"Data Source=(LocalDB)\v11.0;AttachDbFilename=c:\x\x\documents\visual studio 2013\Projects\WebApplication3\WebApplication3\App_Data\Product.mdf;Integrated Security=True";
SqlConnection conn = new SqlConnection(source);
conn.Open();
greetings,
marco.
-
The connection string can be defined in web.config
<configuration>
<connectionStrings>
<add name="pqTestContext" connectionString="data source=localhost;Integrated Security=false;Initial Catalog=x;UID=y;password=z" providerName="System.Data.SqlClient" />
</connectionStrings>
.....
.....
</configuration>
Entity framework is used for database connectivity.
//name of class is same as connection string.
public class pqTestContext : DbContext
{
public DbSet<Invoice> Invoices { get; set; }
public DbSet<Product> Products { get; set; }
public DbSet<Company> Companies { get; set; }
}
In the remote paging demo, pqTestContext refers implicitly to database connection.
pqTestContext db = new pqTestContext();
and then LINQ is used.
var orders = (from order in db.Invoices
orderby order.OrderID
select order).Skip(skip).Take(pq_rPP);
-
Is there a ParamQuery Grid Tutorial for ASP .NET available (like the php-tutorial) where I can see, how the "Controller"-class or the "DbContext"-class in the remote paging demo are working?
Normally i use pqgrid only to show the query results from MS SQL or ORACLE-databases. Now I try to use it to edit the the database entries too.
-
Hi,
I'm also interested to get a sample on ASP.NET Webform instead of PHP demo/samples.
Thanks.
Regards,
Jenson