Jag får detta felmeddelande: Testa: Nu blev det här felet till istället: He, he. Hittade felet. Kan det var så att du glömt '-tecken runt e-mail adressen? Ett litet tips: Såg att jag skrivit lite fel: Andreas... Tack ska du ha.. det löste sig nu....=)The name 'net' is not permitted in this context. Only constants.....
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC SQL Server Driver][SQL Server]The name 'net' is not permitted in this context. Only constants, expressions, or variables allowed here. Column names are not permitted.
Sidkoden ser ut så här:<code>
<%
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Driver={SQL Server};Server=SLEEPWALKER;Database=teambd;Trusted_Connection=True;"
datum = Date()
news = Request.Querystring("news_id")
SQL="Insert Into news_comment(name, email, comment, datum, news_id)"
SQL = SQL & "Values('"& Request("name") &"',"& Request("email") &",'"& Request("comment") &"','" & datum & "','" & news & "')"
Conn.Execute(SQL)
Response.Redirect "javascript:windows.close();"
%>
</code>Sv: The name 'net' is not permitted in this context. Only constants.....
<code>
<%
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Driver={SQL Server};Server=SLEEPWALKER;Database=teambd;Trusted_Connection=True;"
datum = Date()
news = Request.Querystring("news_id")
SQL = "INSERT INTO news_comment(""name"", ""email"", ""comment"", ""datum"", ""news_id"")" & vbCrLf & _
SQL = " VALUES ('" & Replace(Request("name"), "'", "''") & "', " & Replace(Request("email"), "'", "''") & ", '" & Replace(Request("comment"), "'", "''") & "', '" & datum & "', " & CLng(news) & ")"
Conn.Execute SQL
Conn.Close
Response.Redirect "javascript:windows.close();"
%>
</code>Sv: The name 'net' is not permitted in this context. Only constants.....
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near '0'.Sv: The name 'net' is not permitted in this context. Only constants.....
<code>
<%
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Driver={SQL Server};Server=SLEEPWALKER;Database=teambd;Trusted_Connection=True;"
datum = Date()
news = Request.Querystring("news_id")
SQL = "INSERT INTO news_comment(""name"", ""email"", ""comment"", ""datum"", ""news_id"")" & vbCrLf & _
SQL = " VALUES ('" & Replace(Request("name"), "'", "''") & "', '" & Replace(Request("email"), "'", "''") & "', '" & Replace(Request("comment"), "'", "''") & "', '" & datum & "', " & CLng(news) & ")"
Conn.Execute SQL
Conn.Close
Response.Redirect "javascript:windows.close();"
%>
</code>
Kontroller att du har ett värde i news variablen.Sv: The name 'net' is not permitted in this context. Only constants.....
skriv Request.Form("Name")
istället för
Request("Name") osv..
eller om du skickar med method="get"
request.querystring("name")
snabbar upp koden en aning har jag för migSv: The name 'net' is not permitted in this context. Only constants.....
<code>
<%
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Driver={SQL Server};Server=SLEEPWALKER;Database=teambd;Trusted_Connection=True;"
datum = Date()
news = Request.Querystring("news_id")
SQL = "INSERT INTO news_comment(""name"", ""email"", ""comment"", ""datum"", ""news_id"")" & vbCrLf & _
"VALUES ('" & Replace(Request("name"), "'", "''") & "', '" & Replace(Request("email"), "'", "''") & "', '" & Replace(Request("comment"), "'", "''") & "', '" & datum & "', " & CLng(news) & ")"
Conn.Execute SQL
Conn.Close
Response.Redirect "javascript:windows.close();"
%>
</code>Sv: The name 'net' is not permitted in this context. Only constants.....