webmatrix

WebMatrix Database.Query with Custom CommandTimeout

梦想与她 提交于 2019-12-14 03:57:33
问题 Consider the following TestDb with TestTable and Procedure USE TestDb GO --DROP TABLE dbo.TestTable IF NOT EXISTS (SELECT 1 FROM sys.tables WHERE name = 'TestTable') BEGIN CREATE TABLE dbo.TestTable ( RecordId int NOT NULL IDENTITY(1,1) PRIMARY KEY , StringValue varchar(50) NULL , DateValue date NULL , DateTimeValue datetime NULL , MoneyValue money NULL , DecimalValue decimal(19,4) NULL , IntValue int NULL , BitValue bit NOT NULL ) INSERT INTO dbo.TestTable SELECT 'Test', CAST(GETDATE() AS

Using WebMatrix.WebData.WebSecurity in a WPF application

喜夏-厌秋 提交于 2019-12-13 18:33:01
问题 I have an MVC4 internet project that uses the out of the box WebMatrix security. A requirement has come along to add a WPF front end to the same application. I have moved the model into a separate DLL and started building the WPF front end over the same entities. The only issue I am having is trying to integrate with the existing security model. I have added a system.web section into my WPF project's app.config as follows: <system.web> <membership defaultProvider="SimpleMembershipProvider">

Razor C# - Get data from database

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-13 11:51:18
问题 I am using WebMatrix, I have created a database and put a table with a few rows of data. I can connect to it and get the data with the WebGrid , but it only provides a way to output the data using a table. Here is my code for 'shows.cshtml': @{ var db = Database.Open("TVPort"); var shows_data = db.Query("SELECT * FROM shows"); var shows_grid = new WebGrid(source: shows_data); } What I would like to be able to do is enumerate through each row returned by the query, and do whatever I want with

IIS Express fails to serve cshtml files

本小妞迷上赌 提交于 2019-12-13 07:42:34
问题 I've just started checking out WebMatrix, and am running into a problem. I performed a fresh install of WebMatrix, then started a tutorial which involves creating one small cshtml file. Whenever I try to run the site, I get the following error: This type of page is not served. Description: The type of page you have requested is not served because it has been explicitly forbidden. The extension '.cshtml' may be incorrect. Please review the URL below and make sure that it is spelled correctly.

SQL Server edits the table name with dbo as prefix

爷,独闯天下 提交于 2019-12-13 05:36:46
问题 I have been using SQL Server CE for a while. In that database the table names were like UserPosts , UserProfile . But after my upgrade from SQL Server CE to SQL Server the names are edited to dbo.UserPosts , dbo.UserProfile . And also the names of columns are wrapped in square brackets like: [UserProfile] . Why is this bracket used? 回答1: Brackets are used to surround names in SQL Server (they server the same purpose as double quotes). For names that consist of alphanumeric characters and

do I need getJson at all?

好久不见. 提交于 2019-12-13 03:18:19
问题 $(document).ready(function () { $(".viewmap").click(function () { var id = $(this).attr("id"); var responseURL = "~/changemap?id=" + id; //alert(responseURL); $.ajax( { url: responseURL, dataType: "json", type:"GET", success: function (dt) { initialize(dt.Latt, dt.Longt); } } ); } ); }); I use that script to make an ajax call to the page changemap.cshtml which does the following @{ if(!IsPost) { if(!Request.QueryString["id"].IsEmpty()&&Request.QueryString["id"].IsInt()) { var countryId

Building tables with WebMatrix

瘦欲@ 提交于 2019-12-13 02:22:23
问题 I am trying to build a HTML table using WebMatrix (ASP.NET Web Pages) but am having trouble due to the way the HTML tags are opened and closed. What I am trying to achieve is to create a table from a recordset, with three columns, and then fill in any empty columns. This is some test code I am using to work out how to do this using WebMatrix. <table> @{ int row = 0; int col = 0; for (int i = 0; i < 20; i++) //20 cells for test purposes { col++; if (col == 4) { col = 1; } if (col == 1) { row++

Linq to SQL for WebMatrix (Web Pages)

会有一股神秘感。 提交于 2019-12-12 19:07:25
问题 I'm wondering if I can use Linq to SQL in my webmatrix-based sites (C#/Razor etc). I love database searching and stuff and it would be awesome if I could use Linq to SQL for that - or at the least, have rows returned, as a dataset or something and then linq over that. Is this possible with WebMatrix-based sites? I haven't seen anything about Linq in the docs for WebMatrix. 回答1: You can use Linq To SQL or the Entity Framework with Web Pages sites. I would recommend using Visual Studio 2010 SP1

Webmatrix Layout — Inserting into head?

血红的双手。 提交于 2019-12-12 17:13:09
问题 I've created a web site using Asp.Net and the Razor view engine (which is the same as using WebMatrix). Up to now, I've been using SQL to query databases directly, but now I have a page which needs to query a WCF service that returns XML (getting that to return JSON or ODATA maybe is for a separate question). On doing this, I was looking at the best way to do this, and it seems that jQuery may be the answer (unless you have other thoughts). The problem is I'm using SiteLayout using the Layout

Why does some PHP code render as HTML comments

六眼飞鱼酱① 提交于 2019-12-12 16:09:08
问题 I just started learning PHP and installed webmatrix to get started. My first test page renders some of the PHP code as HTML comments. I need help determining what's wrong. One include statement works fine while another in the same file outputs as seen below. None of the PHP code withing HTML displays. The file contains HTML and PHP code and is named with a .PHP extension. I do have PHP enabled in the site settings. For example this line: <? include "phpinfo.php"; ?> becomes: <!--? include