这是我的问题。我需要让用户选择一个服务器,这样我可以有程序连接到该服务器(SQL注意这是C#) 这是我做了什么,但我得到一个异常如何在C#中使用变量作为数据库的名称
//first I make a variable that equals to a textbox text
//take the variable and I place it where I would put your sever name
//heres my code
string SQLC = (textBox1.Text);
con.ConnectionString = (@"Data Source=FORDS-PC;
Integrated Security=True;
Connect Timeout=15;
Encrypt=False;
TrustServerCertificate=False;
ApplicationIntent=ReadWrite;
MultiSubnetFailover=False");
这里是ERROR
类型System.InvalidOperationException 未处理的异常出现在system.data.dll)
让我知道你需要什么,我需要告诉你
那连接字符串中不包含任何_Database = “+ SQLC_ – Steve
问题寻求帮助调试(” 为什么不是这个代码工作?“)必须包括所需的行为,特定的问题或错误以及在问题本身中重现问题所需的最短代码。和可验证的例子请了解异常具有MESSAGE字符串。 – TomTom