我怎样才能在windows认证中提供连接,我在windows认证中没有任何用户身份和密码给belocode。[英] how can i give connection in windows authentication, i dont have any user id, and password in windows authenticationto the belocode

问题描述

private void btnsubmit_Click(object sender, EventArgs e)
        {

            String connectionString = "server=...........;user id=....;password=....;database=abc";
            SqlConnection thisConnection = new SqlConnection(connectionString);
         
            

            thisConnection.Open();

            String thisQuery = "INSERT INTO abc (ID, Name, ContactNo, Email, Address) VALUES (''" + txtid.Text + "'', ''" + txtname.Text + "'', ''" + txtcontact.Text + "'', ''" + txtemail.Text + "'', ''" + txtaddress.Text + "'')";
            SqlCommand thisCommand = new SqlCommand(thisQuery, thisConnection);
            SqlCommand cmd = new SqlCommand();

            thisCommand.ExecuteNonQuery();
            thisConnection.Close();

        }

推荐答案

String connectionString = "server=.;user id='''';password='''';database=abc"


.是本地服务器使用它作为服务器名称只需留空代替 id 并像上面或 belloe 一样传递

String connectionString = "server=.;user id=;password=;database=abc"

本文地址:https://www.itbaoku.cn/post/1394814.html