Hello,
I have some troubles with mine code which selects data from database and show them in the GridView.
ASPX page: 1grid view, 1 button and 2 text boxes
code behind:
Protected Sub cmdVyhledat_Click() Handles cmdVyhledat.Click
SqlDataSource1.DataBind()
GridView1.DataBind()
End Sub
Protected Sub gridview_refresh() Handles SqlDataSource1.DataBinding
If (txtCisloReklamace.Text <> "") And (txtNazevVyrobku.Text <> "") Then
SqlDataSource1.FilterExpression = "(reklamace.cislo_rekl_zak =" & Session("jmeno") & ")"
ElseIf (txtCisloReklamace.Text <> "") And (txtNazevVyrobku.Text = "") Then
SqlDataSource1.FilterExpression = "(reklamace.kod_reklamace = " & txtCisloReklamace.Text & ") AND (reklamace.cislo_rekl_zak = " & Session("jmeno") & ")"
ElseIf (txtCisloReklamace.Text = "") And (txtNazevVyrobku.Text <> "") Then
SqlDataSource1.FilterExpression = "(vyrobky.nazev = " & txtNazevVyrobku.Text & ") AND (reklamace.cislo_rekl_zak = " & Session("jmeno") & ")"
End If
End Sub
I can't get rid of error:
Cannot find column [reklamace.kod_reklamace].
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.EvaluateException: Cannot find column [reklamace.kod_reklamace].
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
When I use only this code, it's all ok, but thats not what I need.
Protected Sub button1_Click() Handles Button1.Click
SqlDataSource1.DataBind()
GridView1.DataBind()
End Sub
Protected Sub gridview1_DataBinding() Handles GridView1.DataBinding
If (TextBox1.Text = "") Then
SqlDataSource1.FilterExpression = ""
Else
SqlDataSource1.FilterExpression = "([kod_reklamace] = " & TextBox1.Text & ") and ([cislo_faktury] =" & TextBox2.Text & ")"
End If
End Sub
Any suggestions how to fix mine problem? /Seems to be caused by INNER JOIN./