Я создал код, который автоматически создает базу данных в папке, где выполняется программное обеспечение. DB был создан успешным, но когда я создаю объект для подключения отображается это исключение:Не удается создать соединение с sqlite DB
System.Data.SqlClient.SqlException (0x80131904): There was a network error or specific instance while trying to establish a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) ---> System.ComponentModel.Win32Exception (0x80004005): Can not find the file specified
на этой линии:
con.Open();
но проблема, я думаю, что на этой декларации связи :
Что я делаю неправильно?
UPDATE Деталь:
SqlCommand command = new SqlCommand(@"INSERT INTO Team (name,code, shortName, squadMarketValue,
crestUrl, link_self, link_fixtures, link_players, caption) VALUES (@name,
@code,@shortName,@squadMarketValue,@crestUrl,@link_self,@link_fixtures,
@link_players,@caption)", con);
Как вы можете видеть, я использую parametizer запрос, и если я использую этот объект:
static SQLiteConnection m_dbConnection = new SQLiteConnection("Data Source=SoccerForecast.sqlite;Version=3;");
переменной con
указываются в красном, компиляторах скажите мне:
it is not possible to convert SqliteConnection in SqlConnection
Какая у вас СУБД? – kmatyaszek
Сообщение - ваш ответ. Вы пытаетесь подключиться к SQL Server (Microsoft). Вам нужен соединитель SQLite. См. Здесь: http://stackoverflow.com/questions/3718362/how-can-i-access-sqlite-with-c – Jauch
Я обновил вопрос, я хочу установить соединение с моей базой sqlite –