Sorry if this question is stupid, but I have no other way to see the big picture. I have 1 text box, 1 shortcut and a database with two columns (code name and description) by entering the code name in the text box. I would like to receive the corresponding description in the label.
With Excel and VBA, this can be done with a few lines. Unfortunately, I cannot use Excel, but I need to choose a web interface for slow PCs and Office pricing. Why is this simple task so complicated in ASP.NET with all the common declarations and sqlservers and sqlconnections.
Is there an easier way to do this?
BTW. I tried to adapt a lot of different things that I found on the Internet, and this last one looks promising, but it does not work:
Protected Sub TextBox2_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox2.TextChanged
Using sqlconn As New SqlConnection("Data Source=.\sqlexpress;Initial Catalog=KLIJENTI;Integrated Security=True"), _
sqlcmd As New SqlCommand("Select From Baza Where SIFRE = @SIFRE", sqlconn)
sqlcmd.Parameters.Add("@SIFRE", SqlDbType.VarChar, 50).Value = TextBox2.Text
sqlconn.Open()
'Label1.Text = CString(sqlcmd.ExecuteScalar()) 'CString is not declared
Label1.Text = sqlcmd.ExecuteScalar()
End Using
End Sub
Baza - ,
SIFRE - ,
NAZIV - , SIFRE, Label