c# - Invalid object name, SQL Exception. Nothing fixes it! -


Therefore, I am trying to fix it for about two months. It all started when my "Dev" machine was cut off and I set it on my laptop. It was joking on my old PC but, it does not work on my new PC and was never on the laptop.

I had already structured SQL Server as much as I had missed before, but it started giving me SQLExceptions I googled it, I searched for here, I tried various solutions None of that

I'll post the offensive code and I hope someone will be able to help me see my weaknesses. I'm sure this is something stupid.

  SqlCommand sc = sqlc.CreateCommand (); Sc.CommandText = "Select pNumber from database where pNumber = '" + number. Toastring () + "'"; SqlDataReader sdr = sc.ExecuteReader (); If (sdr.Read (). ToString ()! = Null) {sdr.Close (); Sc.CommandText = "Update word SET word = '" + Word + "' WHERE pNumber = '" + Number.ToString () + "'"; Here are the error orders where ---- & gt; Sc.ExecuteReader (); } Other {sdr.Close (); Sc.CommandText = "Insert into database values ​​(" + Number.ToString (+) + ", '' + + '', 0, 0, 0)"; Sc.ExecuteNonQuery (); Sc.CommandText = "Select * from database where pNumber = '" + number. Toastring () + "'"; SqlDataReaderDatareD = sc.ExecuteReader (); For (int x = 0; x & lt; 6; ++ x) {user [x] = dataRead.GetString (x); }} Sqlc.Close ();  

Edit: SqlException: Invalid object name: 'word' on System.Data.SqlClient.SqlConnection.OnError (...

  sc.CommandText = "update word SET word = '+ + Word'" WHERE pNumber = '"+ number.ToString () +"' ";  

should probably read

  sc.CommandText =" database default word = '"+ Word +"' WHERE pNumber = '"+ number Update toString () + "'";  

I in SQL query tablename, all this.


Comments

Popular posts from this blog

MySql variables and php -

url rewriting - How to implement the returnurl like SO in PHP? -

Which Python client library should I use for CouchdB? -