Connecting Web API to SQL server 2008 - sql-server-2008

I am fairly new to .net MVC 4 and WEB API. I need to connect my web API to SQL server 2008 but I'm not sure how exactly. I'll I have seen is examples using the local DB and I can't seem to find my solution.

You might also want to check out this blog post by Jason Zander. He includes a very nice step-by-step walkthrough of building a simple Tourist Attraction Application: My Favorite Features: Entity Framework Code First and ASP.NET Web API.
LocalDB is just another engine that is used to access a SQL server database file .mdf -- just like SQLExpress. Visual Studio 2012 uses LocalDB by default while Visual Studio 2010 uses SQLExpress. Anyhow, you can just replace the connection string used in the tutorial with your actual database connection string.

The following tutorial shows how to create a Web API project and connect to a data source using Entity Framework: msdn
It should give you the gist of what needs to be done.

Related

Azure sql - how to view table data (.net backend)

I have just started using Azure and i created a mobile app , setup a database and chose a .net backend .
I got a preconfigured backend folder which i downloaded and then published to my azure server.
However i have no idea how to verify in the azure portal if its working.
I can see my databases but not the actual tables and content .
I'm using .net backend so easytables are not supported .
Does Azure has something like phpmyadmin that lets me check the content of the database while i'm programming ?
Thanks
You can connect to the database with the usual Sql Server Management Studio tool, or directly from Visual studio using Server/Cloud explorer. If its a SQL Azure database you're connecting to, you need first to find the management blade in the portal for the database and then add your client IP address to the firewall settings for that database server for you to be able to connect from your desktop.
ps. tagged with "MySQL" but title refers to Azure sql - I'm answering in terms of Azure SQL.
Download SQL Server Management Studio

How to publish a asp.net application with mysql

I'm developing a web application using asp.net and mysql. When i run it using visual studio it works fine. But when i'm trying to publish it following errors are coming.Please guide me what to do.
Message in Settings tab:
The database provider is not specified for this connection string. Incremental database publishing is supported only for SqlClient as well as Entity Framework code First models.

Running ASP.NET app with VS2012 debugger uses LocalDB despite connection string in web.config

I want to use SQL 2008 R2 on the server where I run VS 2012, so I created the "membership" database (using Aspnet_regsql tool) and configured it to work with IIS7). Then I created ASP.NET Application and modified the web.config so that connection string points to this database.
Running this app with VS 2012 debugger results with my app creating the LocalDB ASPNETDB.MDF instance in app_data folder. VS ASP.NET Configuration tool when invoked from VS Tools menu shows the LocalDB based data and the running application access this database instead of SQL Server 2008 R2 server - which runs on the same server.
I believe that this is some side-effect of the VS generated web.config file, but despite looking hard, I found nothing suspicious.
Note: this same scenario works just fine with Visual Studio 2010 if I am using it's own generated web.config file.
I would hate to dismiss VS 2012 for this as I am pretty sure that I did something wrong.
I had the same problem as this and needed to change more than just the connection string. I was targeting .NET 4.0 framework not 4.5, not sure how much difference this makes. I had a look on MSDN http://msdn.microsoft.com/en-us/library/6e9y4s5t(v=vs.100).aspx
You need to change not just the connection string but also the membership defaultProvider so that it is a SqlProvider

Mysql to SQL Server 2008

Am using Joomla 1.3 for one of my client website. and now I want to move it to custom asp.net application with SQL Server 2008.
What's the best opensource to handle this migration ?
In other context this answer is answered here: Migrate some data from MySQL to MSSQL
Since you already have full SQL 2008, open the Visual Studio Intelligence BI installed with your SQL installation. Then create a new project "Integration Services Project".
Therefor you create a new connection to your ODBC (should be wizards available). Then add your tables, there you can modify, convert, tranasform the data.
The complete project you can save and add as sheduled task to your sql server agent.
Here is a tutorial which explains more: http://msdn.microsoft.com/en-us/library/ms169917.aspx

Developing a Java web service using Jersey(JAX-RS), mySQL and Eclipse

I have successfully created Web Services from MySQL Database using Netbeans tutorial. However, I would like to develop similar web services using Eclipse IDE. Why Eclipse IDE? There are two reasons for that:
1) This is because i am using Tomcat 7.0 and JEE6. Unfortunately, NetBeans 7.0.1 implements Facade design pattern while using their “Create Web services from Database …” Wizard and it does not have a plugin for Tomcat 7 and EE6.
2) The NetBeans Wizard is helpful but does not help me understand details about using JDBC bridge, managing connections to MySQL DB and creating services to access the DB. Additionally, i want to add authorization for my services so that only registered users will be able to access my web services.
There's a very clear tutorial for building JAX-RS services in the Jersey user guide.
I found this tutorial that contains Restful web services using java and mysql in eclipse. It might be what you were looking for though it is a very simple tutorial. Check it out.
http://www.techpages.org/webservice/simple-restful-web-services-using-java-and-mysql-example/2009/