Click here to Skip to main content
15,889,767 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have written a program with vb.net connect to SQL Server 2005 using dataset.

When I run it on the local area network (intranet) it fails to create the connection
"Data Source = mymachine\SQLEXPRESS;initial Catalog = mydatabase; Integrated Security=True;"

The error message that comes is "mymachine\Guest" connection failed

Please can anyone help me with ideas solve this problem?

thanks
Agbe
Posted
Updated 17-Apr-11 21:22pm
v2
Comments
Dalek Dave 18-Apr-11 3:22am    
Edited for Grammar and Readability.

VB
Imports System.Data.Sqlclient

Public Class Form1
    dim con as SqlConnection("Data Source=VSS27;Initial Catalog=demo;Integrated Security=True")
    Dim dss As DataSet
    Dim sadap As SqlDataAdapter
    Dim rs As SqlDataReader
    Dim cmd As SqlCommand

    Private Sub btnins_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnins.Click
        Dim str As String
        str = "INSERT INTO DEMO(&"textbox1.text" ,&"textbox2.text")
        con = cmd.CommandType(rs)
        cmd = dss.GetObjectData(str)
    End Sub
End Class
 
Share this answer
 
v2
Comments
Dalek Dave 18-Apr-11 3:22am    
Good Answer.
You have given Integrated Security as true, so the account that is trying to connect is Guest account which must not be having an access to the database that you are connecting to.

Either impersonate your calls or provide a username-password in connection string to be used in order to connect to the database.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900