Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/74.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 将查询添加到Visual Studio 2013中的服务器资源管理器后发送到SQL Server_C#_Sql_Asp.net_Sql Server_Visual Studio 2013 - Fatal编程技术网

C# 将查询添加到Visual Studio 2013中的服务器资源管理器后发送到SQL Server

C# 将查询添加到Visual Studio 2013中的服务器资源管理器后发送到SQL Server,c#,sql,asp.net,sql-server,visual-studio-2013,C#,Sql,Asp.net,Sql Server,Visual Studio 2013,我正在使用visual Studio 2013 Professional和Microsoft SQL Server 2012。我在VisualStudio中找到了我的服务器,并创建了到它的数据连接,以便它显示在我的服务器资源管理器中(请参见下图)。但是,我找不到要添加到SQLConnection函数的服务器。我正在使用Visual C在Asp.net 4.5 Web应用程序中创建项目。在按钮2上单击“我得到” An exception of type 'System.ArgumentExcept

我正在使用visual Studio 2013 Professional和Microsoft SQL Server 2012。我在VisualStudio中找到了我的服务器,并创建了到它的数据连接,以便它显示在我的服务器资源管理器中(请参见下图)。但是,我找不到要添加到SQLConnection函数的服务器。我正在使用Visual C在Asp.net 4.5 Web应用程序中创建项目。在按钮2上单击“我得到”

An exception of type 'System.ArgumentException' occurred in System.Data.dll
 but was not handled in user code
 Additional information: Format of the initialization string does not
 conform to specification starting at index 0.` 
代码


您需要提供数据库的完整连接字符串

e、 g


好的,谢谢,我无法让用户id正常工作,所以我将其作为受信任的\u连接打开,这样我就不需要用户名和密码,因为这只在我的机器上运行,所以不会产生安全问题。
    protected void Button2_Click(object sender, EventArgs e)
    {

        SqlConnection vid = new SqlConnection("jason.Delta.dbo");
        {
            SqlCommand xp = new SqlCommand("Insert into account (UserName, Password,FirstName, LastName) Values(@user, @pass, @first, last)");
            xp.Parameters.AddWithValue("@user", UserName);
"Server=myServerAddress;Database=myDataBase;User Id=myUsername;
Password=myPassword;"