Неверное имя объекта playerData.C#

Место общения программистов C#
Гость
Неверное имя объекта playerData.

Сообщение Гость »


in my database i have a table "playerData", but it can't be found, any idea why?

private static void Init() { SqlConnection conn = new SqlConnection(constr); SqlCommand cmd; StreamReader sr = new StreamReader(Application.StartupPath + @"\jogadoras.txt"); string sir; char[] split = { '-' }; conn.Open(); while ((sir = sr.ReadLine()) != null) { string[] siruri = sir.Split(split); cmd = new SqlCommand("INSERT INTO playerData(PlayerName) VALUES (@name)", conn); cmd.Parameters.AddWithValue("name", siruri[0].Trim()); cmd.ExecuteNonQuery(); } MessageBox.Show("Initializarea a fost realizata țavă", "powerr softu lu mură", MessageBoxButtons.OK, MessageBoxIcon.Information); } Im trying to insert from a .txt file into the database, and this error pops up:

System.Data.SqlClient.SqlException: 'Invalid object name 'playerData'.'

jogadoras.txt:

Jose Andrea Popescu Matthew Morman Maria database table

I tried moving the table around, but to no avail.


Источник: https://stackoverflow.com/questions/781 ... playerdata

Вернуться в «C#»