我如何在Windows身份验证中建立连接,我在Windows身份验证中没有任何用户ID和密码? [英] how can i give connection in windows authentication, i dont have any user id, and password in windows authenticationto the belocode
本文介绍了我如何在Windows身份验证中建立连接,我在Windows身份验证中没有任何用户ID和密码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
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();
}
推荐答案
字符串connectionString ="server = .; user id ="''''; password =''''; database = abc"
.是本地服务器使用它作为服务器名称,只是将其留空以代替id并像上面或belloe一样传递
字符串connectionString ="server = .;用户ID =;密码=;数据库= abc"
String connectionString = "server=.;user id='''';password='''';database=abc"
. is local server use it as server name just leave blank in place of id and pass like above or belloe
String connectionString = "server=.;user id=;password=;database=abc"
这篇关于我如何在Windows身份验证中建立连接,我在Windows身份验证中没有任何用户ID和密码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文