Hej kan man använda dessa ihop? Jag får ett felmeddelande (se sist i inlägget). Hoppas att någon kan hjälpa mig. MVH/BoDatabas problem
----------------
' Create an instance of the Command object.
Set CommandObject= Server.CreateObject("ADODB.Command")
DatabaseConnection.Open "Driver={Microsoft Access Driver (*.mdb)};Dbq=" & Server.MapPath("databas1/hemsidor.mdb") & ";"
------------------
<table align=center width=100%>
<tr><TD>
<%
Sub AddUserInformation
Dim SQLDataInsertionString
Dim CommandObject
' Create an instance of the Command object.
Set CommandObject= Server.CreateObject("ADODB.Command")
' The ActiveConnection property is used to connect the Command Object
' to the Connection Object.
Set CommandObject.ActiveConnection = DatabaseConnection
' The SQL string that inserts the guest book data about the
' user is created.
SQLDataInsertionString = "INSERT INTO HemsidorSkane (PostAdress, Bransch," & _
"Datum, Email, URL, Namn," & _
"Beskrivning) VALUES (?,?," & _
"?,?,?,?,?)"
' The SQL statement that actually inserts the data is defined
CommandObject.CommandText = SQLDataInsertionString
' The prepared or pre-compiled SQL statement defined in the
' CommandText property is saved.
CommandObject.Prepared = True
' The parameters of the SQL string are defined below.
CommandObject.Parameters.Append _
CommandObject.CreateParameter("PostAdress",200, ,255 )
CommandObject.Parameters.Append _
CommandObject.CreateParameter("Bransch",200, ,255 )
CommandObject.Parameters.Append _
CommandObject.CreateParameter("Datum",200, ,255 )
CommandObject.Parameters.Append _
CommandObject.CreateParameter("Email",200, ,255 )
CommandObject.Parameters.Append _
CommandObject.CreateParameter("URL",200, ,255 )
CommandObject.Parameters.Append _
CommandObject.CreateParameter("Namn",200, ,255 )
CommandObject.Parameters.Append _
CommandObject.CreateParameter("Beskrivning",200, ,255 )
' Information entered by the user is added to the Guest Book database
CommandObject("PostAdress") = Request.Form.Item("PostAdress")
CommandObject("Bransch") = Request.Form.Item("Bransch")
CommandObject("Datum") = Date
CommandObject("Email") = Request.Form.Item("Email")
CommandObject("URL") = Request.Form.Item("URL")
CommandObject("Namn") = Request.Form.Item("Namn")
CommandObject("Beskrivning") = Request.Form.Item("Beskrivning")
CommandObject.Execute
End Sub
' ########## End Subroutine ##########
If Request.Form.Count <= 0 Then
Response.Write ("I am sorry but you did not fill in the Form.")
Else
' Create an instance of the Connection Object
Set DatabaseConnection = Server.CreateObject("ADODB.Connection")
' Open a connection to the Guest Book File DSN
' Before the following statement can execute properly, you have to
' create a File DSN for the Guest Book database as outlined in the
' book.
DatabaseConnection.Open "Driver={Microsoft Access Driver (*.mdb)};Dbq=" & Server.MapPath("databas1/hemsidor.mdb") & ";"
Call AddUserInformation
DatabaseConnection.Close
Response.Write ("<BR><FONT FACE=Arial,Helvetica SIZE=2><B>Tack, "&Request.Form.Item("Namn")&"!</B><BR>")
Response.Write ("Din hemsida kommer att läggas upp inom 3 dagar!</FONT>")
End If
%>
<BR>Jag vill
[Lägga in fler hemsidor]
<br>
</TD>
</TD>
</TABLE>
---------felmeddelandet---------------
Technical Information (for support personnel)
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query.
/test/roger/Include_laggtillhemsida_skanecentrum_insert.asp, line 64
Browser Type:
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022)
Page:
POST 113 bytes to /test/roger/laggtillhemsida_skanecentrum_insert.asp
POST Data:
Bransch=Banker&PostAdress=Brom%F6lla&Beskrivning=tyuytu&URL=tyutyu&Namn=tyutyu&Email=tyuty&Submit.x=32&Submit.y=8