I inserted path of connection string to database(A). The path use for connect database(B). When i select that path from database(A) and try to connect database(B). This is alert message show
Keyword not supported: '@"data source'.'
This is connectstring in database(A) :
@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\it_staff\source\repos\MonitorProduction_Client\MonitorProduction_Client\App_Data\monitorclientdb.mdf;Integrated Security=True"
connect_db.conn.Close();
connect_db.conn.Open();
SqlCommand cmd_select_connect_string = new SqlCommand("select board_connect_string from[board] where board_id='" + board_id_[0] + "'", connect_db.conn);
if (cmd_select_connect_string.ExecuteNonQuery() != 0)
{
SqlDataReader rd = cmd_select_connect_string.ExecuteReader();
while (rd.Read())
{
var board_connect_string = rd[0];
connect_db.connb=new SqlConnection(board_connect_string.ToString());
}
}
@
before opening double quotes which is not allowed. – Tetsuya YamamotoExecuteNonQuery
andExecuteReader
on aSELECT
query? You can just useHasRows
property after doingExecuteReader
, no need to useExecuteNonQuery
here. Also check if connection string contains incorrect newline or wrongproviderName
. – Tetsuya Yamamoto