2 Replies - 663 Views - Last Post: 11 July 2012 - 03:48 PM Rate Topic: -----

#1 Memsey  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 26
  • Joined: 11-July 12

Linking asp.net web site to sql server database using vb.net

Posted 11 July 2012 - 02:43 PM

I am currently developing a website using Microsoft's Visual Web Developer 2008 Express Edition.

Up until this week I was using MS Access as my database. However MS Access has started playing up and, after some research, online I have decided to move forward and learn about using MS SQL Server as my database.

Here is the problem I'm having. I used to use an OleDb connection to manipulate the data in my MS Access db using vb.net.

The connection string I used to use for this was as follows:

Dim DataConn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; data source=" & Server.MapPath("App_Data/mydatabase.mdb"))



I used this connection string because my database was stored within my app_data folder in VWD2008.

I now have a MS SQL DB sitting in the app_data folder which mimicks my old Access db.

What connection string do I need to use to connect to this database?

The reason I have my database saved to the app_data folder is because when I launch the website I am going to pay a host to host the website and the database for me. I therefore want to have my db in app_data to keep development simple - my knowledge is limited and moving from nice and straight forward Access to MS SQL Server has scared me a little!

Any help or guidance would be much appreciated! I am not asking for someone to write the string for me, just a little help would be great or some guidance towards some good resources for this.

Thanks!

Is This A Good Question/Topic? 0
  • +

Replies To: Linking asp.net web site to sql server database using vb.net

#2 Memsey  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 26
  • Joined: 11-July 12

Re: Linking asp.net web site to sql server database using vb.net

Posted 11 July 2012 - 02:52 PM

I understand that the following is the usual connection string for an SQL Server db but was wondering if, because my database is in my app_data folder, there is an easier way to connect to my new MS SQL Server db. Thanks!!

connectionString = "Data Source=ServerName;Initial Catalog=DatabaseName;User ID=UserName;Password=Password"


Was This Post Helpful? 0
  • +
  • -

#3 Memsey  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 26
  • Joined: 11-July 12

Re: Linking asp.net web site to sql server database using vb.net

Posted 11 July 2012 - 03:48 PM

ended up finding a solution to this. Used the following as my connection string:

Data Source=.\SQLExpress;Integrated Security=true; AttachDbFilename=|DataDirectory|\mydb.mdf;User Instance=true;


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1