ho 'sto codice:
apparentemente giusto ma mi dà 'sto errore:codice:Sub Page_Load() Dim str as string = "Server=xxx.xxx.xxx.xxx;Database=CURRICULUM;User ID=xxx;pwd=xxx" Dim conn as new sqlconnection(str) conn.open() Dim sql as string = "SELECT ID_USER, DATA_CREAZIONE, NOME FROM ANAGRAFICA WHERE ISDEL = 0 " If Session("INFO") = "" then else sql &= " AND NOME LIKE " + Session("INFO") + "" end if If Session("CF") = "" then else sql &= " AND FISCALE = " + Session("CF") + "" end if If Session("DATA_INI") = "Scegli/Scegli/Scegli" then else sql &= " AND DATA_CREAZIONE BETWEEN = '" + Session("DATA_INI") + "' AND '" + Session("DATA_FIN") + "'" end if sql &= " ORDER BY DATA_CREAZIONE DESC" response.Write(sql) Dim cmd as new sqlcommand(sql, conn) Dim dr as sqlDatareader = cmd.ExecuteReader() While dr.read() response.Write("<table border='1' width='70%'><tr><td width='5%'>" + CStr(dr.Item("ID_USER")) + "</td>") response.Write("<td width='15%'>" + dr.Item("DATA_CREAZIONE") + "</td>") response.Write("<td width='50%'>" + dr.item("NOME") + "</td>") If Session("edi") = 1 then response.Write("<td>[img]../img/edit.gif[/img]</td>") end if if session("del") = 1 then response.Write("<td><a href='delete.aspx?id=" + CStr(dr.Item("ID_USER")) + "&nm=" + CStr(dr.Item("NOME")) + "' target='topFrame'>[img]../img/delete.gif[/img]</td>") end if response.Write("</tr></table>") end while dr.close() conn.close() end subServer Error in '/wcv' Application.
--------------------------------------------------------------------------------
Line 1: Incorrect syntax near '='.
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.SqlClient.SqlException: Line 1: Incorrect syntax near '='.
Source Error:
Line 23: response.Write(sql)
Line 24: Dim cmd as new sqlcommand(sql, conn)
Line 25: Dim dr as sqlDatareader = cmd.ExecuteReader()
Line 26: While dr.read()
Line 27:
Source File: D:\Wcv\Admin\reader.aspx Line: 25

Rispondi quotando