I'm using visual studio 2008. How can i use linqtosql on the sql server project?
+1
A:
The sql server project type is for managing DB objects, it is not a coding language project type.
http://msdn.microsoft.com/en-us/library/c8dbfz8s.aspx
If you want to use LinqToSql to connect to a database you must use a language specific project like C# or VB.NET.
keithwarren7
2009-12-29 18:21:39
But i found this project http://www.codeproject.com/KB/database/SqlRegularExpressions.aspx . this use regular expression. This how can work? I don't understand
ebattulga
2009-12-29 18:26:19
That is using a new type of object introduced in SQL 2005 called a CLR Stored Procedure.
keithwarren7
2009-12-29 20:27:49
A:
It's not clear exactly what you're asking for help with. But let's start with this:
- Start Visual Studio 2008.
- Select New Project->Visual C#->Windows->Empty Project.
- Right click on the project in Solution Explorer->Add New Item->Visual C# Items->Data->LINQ to SQL classes. Double click the newly added dbml file to open it in the main window.
- View->Server Explorer->Right click Data Connections->Add Connection.
- Key in the connection parameters to your database.
- In Server Explorer expand the server you just added->expand tables->left click and drag one of your database tables to the main window (the designer surface).
Presto, you have now created your first LINQ to SQL-enalbed DataContext
.
Jason
2009-12-29 18:26:31
how to use linq on "SQL SERVER PROJECT". I know use linq on simple c# project
ebattulga
2009-12-29 18:32:37
Repeating yourself and shouting at me isn't going to make it more likely that I continue to try to help you. I stated that it was not clear what you are asking for and made an earnest effort to help you. Please clarify what you're trying to do.
Jason
2009-12-29 18:34:34
I'm creating stored procedure using SQL SERVER PROJECT. When i create stored procedure, i need to use linq. My question is, it is possible to use linq on this stored procedure
ebattulga
2009-12-29 18:39:42
No. SQL Server Projects are for creating and manipulating CLR SQL Server objects (stored procedures, user-defined types, aggregates, etc.) That is, they are for using .NET inside SQL Server. As far as I know, LINQ-to-SQL will not work in this scenario at least not in SAFE mode as `System.Data.Linq` is not in the approved list of assemblies. At best you could try in UNSAFE mode, but I'm not even sure about that.
Jason
2009-12-29 18:49:02
This thread on MSDN forums seems to confirm what I am saying: http://social.msdn.microsoft.com/forums/en-US/sqlnetfx/thread/a553dfad-9fe2-42ab-a46a-be66760249cf/
Jason
2009-12-29 18:53:55