SQL express on a remote machine

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Aug 2005
Posts: 5,264
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 377
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

SQL express on a remote machine

 
0
  #1
Aug 23rd, 2007
Hullo daniwebbers!!

I have created a little cd database at home on my home network. And I want my machine to act as the server. I want the other pcs, i.e my sister's and mom's which are connected to my network to access it, and be able to change and update stuff. So they can add and remove music entries.

But I'm confused, has anyone used SQL express on a remote machine. If so pleasse give me a helping hand. Help.

Thanx.
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 322
Reputation: Hamrick will become famous soon enough Hamrick will become famous soon enough 
Solved Threads: 33
Hamrick's Avatar
Hamrick Hamrick is offline Offline
Posting Whiz

Re: SQL express on a remote machine

 
0
  #2
Aug 23rd, 2007
Are you writing a VB.NET application to do it? Is the database configured for remote access? What problems are you having right now? I need more info before I can help you.
The truth does not change according to our ability to stomach it.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,264
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 377
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

Re: SQL express on a remote machine

 
0
  #3
Aug 23rd, 2007
Thanx Hammie,

I'm using vb.net express, with SQL express (200mb) download. I don't know where to configure the database for remote access?

Let me get all the info (my ips or computer names) together and I'll post back.
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 322
Reputation: Hamrick will become famous soon enough Hamrick will become famous soon enough 
Solved Threads: 33
Hamrick's Avatar
Hamrick Hamrick is offline Offline
Posting Whiz

Re: SQL express on a remote machine

 
0
  #4
Aug 23rd, 2007
This knowledge base article takes you through the steps of configuring the server. Once you have it set up, you should be able to connect normally from another machine on the network.

When you connect through .NET, be sure to include the server machine name. A lot of examples use ".\SQLEXPRESS" or "(local)\SQLEXPRESS" instead of "<server>\SQLEXPRESS". The connection string should look like this.
  1. "Server=<server>\SQLEXPRESS;User ID=<username>;password=<password>;Database=<databasename>;Persist Security Info=True"
I'll attach a little program that you can use to build connection strings and test the connection with your database.
Attached Files
File Type: zip ConnectionTester.zip (58.5 KB, 110 views)
The truth does not change according to our ability to stomach it.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,264
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 377
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

Re: SQL express on a remote machine

 
0
  #5
Aug 23rd, 2007
Thanx jdaughtry but where do I put that connection thing in my program?
Last edited by iamthwee; Aug 23rd, 2007 at 4:15 pm.
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 322
Reputation: Hamrick will become famous soon enough Hamrick will become famous soon enough 
Solved Threads: 33
Hamrick's Avatar
Hamrick Hamrick is offline Offline
Posting Whiz

Re: SQL express on a remote machine

 
0
  #6
Aug 23rd, 2007
That's up to you. I like to put it in a static property for a Program class that I make for stuff that needs to be available across the entire application. Other stuff in that class would be the entry point, error logging and user notifications, or cached data.
  1. Public Class Program
  2. Private _connectionString As String
  3. Public ReadOnly Property ConnectionString As String
  4. Get
  5. Return _connectionString
  6. End Get
  7. End Property
  8.  
  9. Public Sub LoadSettings()
  10. ' Read the connection string from some storage medium
  11. ' Decrypt the connection string if necessary
  12. End Sub
  13.  
  14. Public Sub SaveSettings()
  15. ' Save the connection string to some storage medium
  16. ' Encrypt it if you don't want it to be plain text
  17. End Sub
  18. End Class
When the program loads I'll read the connection string from XML or a database, or call the ConnectionBuilder to make one for me using a public method from the same class. Then you can get to it from anywhere in the application by saying Program.ConnectionString. And if you use the ConnectionBuilder you can save it somewhere so that you don't have to rebuild the connection string every time.
The truth does not change according to our ability to stomach it.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,264
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 377
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

Re: SQL express on a remote machine

 
0
  #7
Aug 23rd, 2007
Ok, I need to look at this more carefully. I probably post back tomorro with more questions. Thanx again Jdaughtry!
Last edited by iamthwee; Aug 23rd, 2007 at 4:28 pm.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,264
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 377
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

Re: SQL express on a remote machine

 
0
  #8
Aug 24th, 2007
Ok I tried to change the connection string but it won't let me. I can't edit it. This is where I am stuck.

click_me
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 322
Reputation: Hamrick will become famous soon enough Hamrick will become famous soon enough 
Solved Threads: 33
Hamrick's Avatar
Hamrick Hamrick is offline Offline
Posting Whiz

Re: SQL express on a remote machine

 
0
  #9
Aug 24th, 2007
You don't edit it during the wizard, it saves the string in all of the generated code that gets written after you finish the wizard. But all of that stuff makes working with connections harder if you don't already know how it wokrs. You should do it manually instead so that you know how everything works and then do the generated code if you want to later.

You can boil it all down into a few lines manually while the generated code cranks out hundreds of lines of extra stuff. If you use a wizard, you're making generated code and life starts to suck.
  1. using System;
  2. using System.Data;
  3. using System.Data.SqlClient;
  4.  
  5. public class DataManager {
  6. public static DataTable ExecuteSql( connectionString ) {
  7. try {
  8. // A connection gets you access to the database.
  9. using ( SqlConnection con = new SqlConnection( connectionString ) ) {
  10. // A command has the query stuff for the database.
  11. using ( SqlCommand cmd = new SqlCommand() ) {
  12. // Always open the connection. :)
  13. // If the connection object is in a using statement, the Dispose
  14. // method closes it automatically.
  15. con.Open();
  16.  
  17. // Set up the command and attach it to the connection.
  18. cmd.Connection = con;
  19. cmd.CommandText = "select * from mytable";
  20.  
  21. // A data adapter links commands to disconnected datasets.
  22. using ( SqlDataAdapter da = new SqlDataAdapter( cmd ) ) {
  23. // Put the resultset in a data table and you're done!
  24. using ( DataTable result = new DataTable() ) {
  25. da.Fill( result );
  26. return result;
  27. }
  28. }
  29. }
  30. }
  31. } catch ( Exception ex ) {
  32. // Log the error
  33. throw;
  34. }
  35. }
  36. }
The truth does not change according to our ability to stomach it.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 5,264
Reputation: iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold iamthwee is a splendid one to behold 
Solved Threads: 377
Featured Poster
iamthwee's Avatar
iamthwee iamthwee is offline Offline
Posting Expert

Re: SQL express on a remote machine

 
0
  #10
Aug 24th, 2007
You got a vb.net example, I'm struggling to convert that to vb.net? Thanx. Links would be good.
Last edited by iamthwee; Aug 24th, 2007 at 4:45 pm.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC