Я получаю исключение, которое не понимаю:
System.Data.SqlClient.SqlException: 'Неверный синтаксис рядом с' Clienti '.'
Это мой код, приводящий к ошибке:
string connectionString = @"Data Source=VONWOLFENSPC\MSSQLSERVER01;Initial Catalog=Gestionare_excursii_agentie_turism;Integrated Security=True";
SqlConnection sqlCon = new SqlConnection(connectionString: connectionString);
string selectsql = "Select G.Nume, G.Prenume, G.Telefon, G.NumarInsotitori, " +
"G.ClientID, G.Sex, " +
"(Select E.Nume From Excursii E where E.ExcursieID LIKE G.ExcursieID) AS Excursie" +
"From Clienti G Where G.CNP Like @cnp";
SqlCommand cmd = new SqlCommand(selectsql, sqlCon);
cmd.Parameters.AddWithValue("@cnp", comboBox2.Text);
try
{
sqlCon.Open();
// error happens on the next line
using (SqlDataReader read = cmd.ExecuteReader())
{
while(read.Read())
{
//...
}
}
}
finally
{
sqlCon.Close();
}
Как я могу это исправить?