MVC :: SQL Server 2005 - Stored Procedures - NO LINQ?

Jan 27, 2010

I'm totally new to MVC (started this morning), and am totally at a loss where to start. I need to rebuild an existing website. I already have a SQL Server 2005 database with tables and stored procedures. In the old version of the website, I built a function to call stored procedures and return the results as a datareader in VB.Net.

I want to use ASP.NET MVC with C#.

The first question I have is: Where would I put the code for the function that calls stored procedures ?

My second question is: Where do I go from there? I just need to get a sense of the basic way to handle presenting a dynamic website. I just want to start out with a Site.Master and display my menus which need to be generated dynamically from my database. I've been googling all day and I haven't really found any posts which answer all of my questions.

View 4 Replies


Similar Messages:

SQL Server :: Transfer Some Tables And Stored Procedures From 2005 To Express 2008?

Sep 4, 2010

I am trying to transfer some tables and stored procedures from SQL Server 2005 to Express 2008. I have tried using Management studio, but it isn't working....

View 5 Replies

DataSource Controls :: LINQ With Stored Procedures?

Mar 29, 2010

Im new to ASP.NET (Normally use PHP), and im currently designing a website in VB.NET and SQL Server.

When using LINQ to SQL i know that it uses parametarized queries and we dont need to add them.

So do we need to use Stored Procedures in LINQ (for security reasons)???, If yes How

View 3 Replies

ADO.NET :: Linq To Sql Column Mismatch Using Stored Procedures?

Aug 26, 2010

I'm using Linq to Sql to call some stored procedures for more complex work; is there any way Linq to Sql can tell me when the output columns from the stored procedure do not match the properties of my entity object? It seems that Linq to Sql tries its best to match the columns and ignores any mismatches.

View 8 Replies

ADO.NET :: Return Type Of Linq To SQL Stored Procedures?

Sep 20, 2010

I am using .net framework 3.5 and sql server 2008.

In my project coding, I want to call stored procedures in sql server 2008.

return value is the object list which references the entity.

But I have the questions.

If in the entity named as "order", is it matching the properties or created through entity constructor??

In my case, I have two properties and one constructor which match one property.

public class orders

{
orders ( string orderid)
{
this.orderid=orderid;
}
public string orderid {get;set;}
public string orderno{get;set;}
}

View 1 Replies

ADO.NET :: Inserting Records Using Stored Procedures In LINQ To SQL In MVC

Mar 11, 2011

I am inserting records using stored procedures in LINQ to SQL in MVC.but i don't know the proper way.

View 1 Replies

ADO.NET :: Linq To Sql Stored Procedures - Set Correct Return Type?

Dec 15, 2010

I've recently inherited an ASP.NET 2.0 project from other developers and they have a LinqToSql datacontext with stored procedures. I've been asked to modify one of the SPs which is essentially just adding a couple columns to the database table and then those to parameters to the SP. So I delete the existing SP from the L2S context and drag in the new one with the additional fields, and all hell breaks loose. Suddenly I get over 20 errors! What seems to have occured is L2S has modified many other stored procedures that I haven't even touched and changed the return type from ISingleDefault<some object> to int. I've never used stored procedures before with L2S so I don't know if this is standard behavior or not. Does anyone know why this has happened and how to fix it to set the correct return type?

View 3 Replies

DataSource Controls :: Use Stored Procedures From LINQ With A Using Clause ?

May 25, 2010

Ive created a new LINQ To SQL class and dragged several tables across from my server, in my code I access them like this

[Code]....this is all ok, however, I have several stored procedures that I want to use as well, but when I drag the stored procedures across I get a compilatiopn error

Error 60 'DB_BL.DB_BLDataContext': type used in a using statement must be implicitly convertible to 'System.IDisposable'

how do I use stored procedures from LINQ with a using clause ?

View 7 Replies

C# - Linq-To-SQL CreateDatabase Doesn't Create Stored Procedures?

Feb 11, 2011

I have Linq-to-SQL DataContext and I run:

datacontext.CreateDatabase()

This works fine.

Recently I dragged a stored procedure onto the methods pane. I was thinking this stored procedure was now part of the datacontext and would get regenerated when creating the database.

View 2 Replies

DataSource Controls :: Using Sql Stored Procedures - Does Linq Still Make Sense?

Jan 4, 2010

If this is not the appropriate forum for this I didn't see any linq specific forum listed.

I am about to start a new project and I would like to use it as an opportunity to update myself with the newer technologies, like ajax and linq.


All my database CRUD operations will be done by sql stored procedures, does linq still make sense when doing that? I watched a couple introductory videos on linq and none of them dealt with stored procedures, thats why I'm wondering.

View 10 Replies

DataSource Controls :: Good Way To Use Linq With Update Stored Procedures?

Jun 9, 2010

I like to use my own stored procs as much as possible.

That way I know exactly what's happening and I can explain and control things.

I'm using stored procs with LINQ to SQL for CRUD operations.

For select, insert and delete - using stored procs with LINQ to SQL is pretty straightforward.

However, if I want to use my own custom stored procs with L2S for updates what's the best way to accomplish this?

Can you provide some code that shows the best approach that you would personally choose for this?

View 1 Replies

ADO.NET :: How To Call A Stored Procedures With Varchar Output Parameters In LINQ

Oct 15, 2010

I have a stored procedure with the following structure:

[Code]....

View 4 Replies

DataSource Controls :: LINQ Using Stored Procedures And MvcContrib Grid With Pagination?

Jan 12, 2010

I have been chasing this erorr all day and coming up blank. I created a stored proceudre(fairly complicated logic), added it to the context, and set the return type to a specific entity type.

It generated this:

[Function(Name="dbo.usp_ServiceTemplateSelectByFkID")]
public ISingleResult<ServiceTemplate> usp_ServiceTemplateSelectByFkID([Parameter(Name="FkId", DbType="Int")] System.Nullable<int> FkId)
{
IExecuteResult result = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())), FkId);
return ((ISingleResult<ServiceTemplate>)(result.ReturnValue));
}

I call it from my service with the following method:

public ISingleResult<ServiceTemplate> GetByFkId(int FkId)
{
return Db.usp_ServiceTemplateSelectByFkId(FkId);
}

I have tested the stored procedure and it returns the results I want. When I make the service call from the controller, it doesn't error out, however, it should return 4 records in this instance and instead, it returns the same 4 records (repeating the first record 4 times).

In addition, in my controller code, I am using the MVCContrib ToPagedList() method which doesn't appear to work with the ISingleResult interface (forward only cursor, I'm guessing). I have attempted converting the service results to IQuery, List, and Array, however, I still have the problem with the first record being repeated 4 times.

View 3 Replies

SQL Server :: Script All Stored Procedures In One Hit?

Nov 18, 2010

I've been working on an upgrade for an app that's currently online.

I copied the database to my development server, have been making upgrades to the db (new tables, additional stored procedures, functions, etc). The new upgraded db is now complete and ready to go back online. I developed a script for all the new tables as I created them.

Basically this new db will go with the new upgraded app at a new domain.

So my plan is this...

Copy my existing db (the original) over to the new server.Run the script I developed on my development server to upgrade the new db to the latest version. Take the original db offline once the new one is running. However when I developed the new sps and fcns I didn't script them like I did for the tables (ooops! not thinking), and I have about 100 new sps. Is there anyway to script all the sps in one hit, so that I can run one script to upgrade the new db?

Or do I have to script them individually?

View 2 Replies

SQL Server :: Retrieving Data From Stored Procedures?

Feb 2, 2011

I need to retrieve data from a stored procedure, but not from a reader. I need to insert and read to see if there is an error code returned so I can Display It

[Code]....

This inserts data into a stored procedure, since I have a promotion going on, I want to check to see if anyone has tried to create several accounts to try to be Customer #100 or so on, I have achieved this in the procedure, and set RETURN @ErrorCode = 1

Have I Set up the SqlParameter Correctly, or do I now have to declare a direction for each parameter?

I have had problems reading from Stored Procedures and Tutorials Seam Straightforward, but thay are about readers only not Input Output

View 3 Replies

SQL Server :: How To Debug Queries And Stored Procedures

Mar 24, 2011

How to debug queries and stored procedures in sql server 2008 like we doing in vs

View 1 Replies

SQL Server :: Working With Two Tables Using Stored Procedures?

Dec 20, 2010

I am trying to insert some data into a table and update another table using the same stored procedure but it doesn't work.

ALTER PROCEDURE dbo.new_suppliers_orders_add_products
@SupplierOrderID int,
@ProductID int,
@OrderQuantity int,
@NewOrderQuantity int
AS
INSERT INTO SupplierOrderLine(SupplierOrderID, ProductID, OrderQuantity) VALUES (@SupplierOrderID,@ProductID, @OrderQuantity)
UPDATE Products SET QuantityOnOrder = @NewOrderQuantity WHERE ProductID=@ProductID
RETURN

Is it any way it can be done or I need to use two separate stored procedures?

View 7 Replies

SQL Server :: How To Return Values From Stored Procedures

Aug 13, 2010

how to return list of values(single column values) from stored procedures in sqlserver 2005?

View 4 Replies

SQL Server :: Stored Procedures Output Parameters?

Mar 16, 2011

I have never used stored proc ouput parameters i want to know what is the use of using output parameters?If possible provide me some code.

View 10 Replies

SQL Server :: Pass The In Out Parameters In Stored Procedures?

Dec 12, 2010

how to pass the in out parameters in stored procedures

and how to execute it??

View 10 Replies

Web Forms :: Merge Two Stored Procedures In SQL Server

Oct 5, 2012

I use below store procedure that don't allow insert duplicate data in database in code column 

ALTER procedure [dbo].[insertestate1]
@position nvarchar(max)
,@Transfer nvarchar(20)
,@Type nvarchar(20)
,@Behcode nvarchar(10)

[Code] ....

And this is my other SP that  I define Condition ,and  according to that condition  it update or insert data in database

USE [behtop]
GO
/****** Object: StoredProcedure [dbo].[insertestate] Script Date: 10/04/2012 11:36:21 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER procedure [dbo].[insertestate]

[Code] ....

In first SP @code parameter is column in table that I don't want accept duplicate value and condition of that is:

IF NOT EXISTS(SELECT behcode FROM Estate_p WHERE code = @code)

And  in second SP I have @code parameter that I don't want it insert duplicate data on it too. But here condition is 

IF @id > 0 AND EXISTS(SELECT behcode FROM Estate_p WHERE id=@id)

Now I want merge two SP .. How I can do it?

View 1 Replies

Calling Sql Server 2008 Stored Procedures Via Dblinks ?

May 6, 2010

Can this be done?

View 4 Replies

SQL Server :: Stored Procedures In Server 2008?

Dec 11, 2010

Informative link for the complete tutorial about how to write stored procedure in sql server 2008and how to call it at runtime on button event generation on website page..

View 7 Replies

DataSource Controls :: Prevent Server/Database To Have SQL Stored Procedures Encrypted?

May 13, 2010

I have access to two servers, one with my development database on, and another with the live database on.

All SQL Stored Procedures, Functions, Views are encrypted on the live database (using WITH ENCRYPTION in my query)

However I'm concerned I might accidentally encrypt a bunch of SProcs on my development database meaning I can no longer view/edit that code.

I have full control over the server and database, and was wondering if there is a way I can prevent these from being encrypted, therefore throwing up an error when this is attempted?

View 4 Replies

SQL Server :: Want The User To Be Able To Select, Update, Delete, Add Data As Well As Execute Stored Procedures?

Aug 16, 2010

I have built a web app and want the user to be able to select, update, delete, add data as well as execute stored procedures, I thought that I would get this from the db_datareader and db_datawriter roles but I get an error when trying to select data etcFor instance I get an error when trying to run the stored procedure ups_AddCustomer when the user has the assigned roles db_datareader & db_datawriter but it works fine when the db_dbowner but i would rather not have the page user having full access to the database.

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved