Goran Bibic

Goran Bibic

  • 484
  • 2.9k
  • 198.5k

Execute scalar c#

May 24 2018 1:15 AM
If put in text box username (a) and password (a) app say invalid column name "a"
 
Line 10 problem....some help?
  1. private void prijava()  
  2.         {  
  3.               
  4.   
  5.             SqlConnection myConnection = new SqlConnection(cs);  
  6.             String command = "SELECT id FROM osobe_korisnici where korisnicko_ime = " + korisnikTextBox.Text + "";  
  7.             myConnection.Open();  
  8.             SqlCommand myCommand = new SqlCommand(command, myConnection);  
  9.             
  10.             korisnikId = Int32.Parse(myCommand.ExecuteScalar().ToString());

Answers (5)