hello friend,

can someone help me, i want to learn how to connect my app database from another computer using code, i already try to change connection string = "Data Source=-SERVERNAME-\SQLEXPRESS;Initial Catalog=SmartHome;Integrated Security=True" but its still same, someone please help me, im using win8, microsoft sql server 2008, Visual studio 2010

What Adapter are you using?

SQLClient, OLEDB, ACE ?

If you are using SQLClient Then try something like this:

Try
    Dim con As New SQLConnection("Data Source=MYSERVEr;Initial Catalog=MYDATABASE;Integrated Security=True")
    con.Open
Catch ex As Exception
    MsgBox(ex.ToString)
End Try

im using SQLclient, but its still same, nothing happen....code that you give like i said at my question, see my connection string, its same, so i think that maybe have some setting that need to do...

Are you getting an error?

Or are you confusing connection with command?

A command would be:

Dim con As New SQLConnection("Data Source=MYSERVER;Initial Catalog=MYDATABASE;Integrated Security=True"
Dim com As New SqlCommand("SELECT * FROM table",con)   
Dim da As New SQLDataAdapter(com)
Dim ds As New DataSet

da.Fill(ds,"MyTable")

yes! its same you can see my connection string on my question...its cant run from another computer.

What error are you getting on the other computer?

If you are using a DNS name on a server that is not on the same network as the other computer - then you will have to use the ip of the server.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.