将VB.net连接到SQL Server 2005并在Intranet上的软件上运行 [英] Connect VB.net to SQL Server 2005 and Run on software on intranet

查看:75
本文介绍了将VB.net连接到SQL Server 2005并在Intranet上的软件上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经用vb.net编写了一个使用数据集连接到SQL Server 2005的程序.

当我在局域网(内联网)上运行它时,它无法创建连接
"Data Source = mymachine\SQLEXPRESS;initial Catalog = mydatabase; Integrated Security=True;"

出现的错误消息是"mymachine \ Guest"连接失败

请任何人帮我解决这个问题吗?

谢谢
Agbe

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

推荐答案

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


您已将Integrated Security设置为true,因此尝试连接的帐户是Guest帐户,该帐户必须不能访问数据库您正在连接的.

冒充您的呼叫或在连接字符串中提供用户名密码以用于连接到数据库.
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.


这篇关于将VB.net连接到SQL Server 2005并在Intranet上的软件上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆