p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

proasp_codeclinic thread: error to submit the values in SQL server


Message #1 by intzar ali lashari <i_lashari@y...> on Wed, 9 May 2001 00:54:37 -0700 (PDT)
Dear friend,
I think the problem is located in your connect string:
strConnect = "Provider=SQLOLEDB;Persist Security
Info=False;" & _
                 "User ID=sa;Initial Catalog=Movie;" &
_
                 "Initial File
Name=C:\MSSQL7\Data\Movie2000.mdf"

Please try correct it:

strConnect = "Provider=SQLOLEDB;Persist Security
Info=False;" & _
                 "User ID=sa;Initial Catalog=Movie;" &
"Data Source=yoursqlserver"
  You replace "yoursqlserver" with name of SQL Server.
Good luck.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: Le Huu Duc
Information System Section
Tel: 332
E-Mail: lhduc@m...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

----- Original Message -----
From: "intzar ali lashari" <i_lashari@y...>
To: "Code Clinic" <proasp_codeclinic@p...>
Sent: Wednesday, May 09, 2001 2:54 PM
Subject: [proasp_codeclinic] error to submit the values in SQL server


> dear sir
>      I am working with ado for asp but i found this
> error with complete code I applied to access and run
> successfully but when with sql server this problem
> occures i also have upsize movie2000.mdb file from
> access.
>                       I shall be thank full to act of
> kindness
>                                 regards
>                                 Intzar ali Lashari
>
>
>
>
> My addnew.asp code is this
> <%
>   Option Explicit
>   Dim strConnect
> %>
> <!-- #include file="DataStor.asp" -->
> <!-- METADATA TYPE="typelib"
>               FILE="C:\Program Files\Common
> Files\System\ado\msado15.dll" -->
> <HTML>
> <HEAD>
> <TITLE>Adding a New Record</TITLE>
> </HEAD>
> <BODY>
> <%
>   Dim objRS, intIDForNewRecord
>   Set objRS = Server.CreateObject ("ADODB.Recordset")
>   objRS.Open "Movies", strConnect, adOpenStatic,
> adLockOptimistic, adCmdTable
>
>   objRS.MoveLast
>   intIDForNewRecord = objRS("MovieID") + 1
>
>   objRS.AddNew           ' add a new record
>   objRS("MovieID") = intIDForNewRecord
>   objRS("Title") = "Psycho"
>   objRS.Update
>   objRS.Close
>
>   objRS.Open "SELECT * FROM Movies WHERE MovieID=" &
> intIDForNewRecord, _
>                    strConnect, adOpenForwardOnly,
> adLockReadOnly, adCmdText
>   If objRS.EOF Then
>     Response.Write "New record not found - something
> went wrong"
>   Else
>     Response.Write "You've successfully added a new
> record:<BR> " & _
>                    "Movie title = '" & objRS("Title")
> & "'<BR>" & _
>                    "MovieID = "      &
> objRS("MovieID")
>   End If
>
>   objRS.Close       ' now close and clean up
>   Set objRS = Nothing
> %>
> </BODY>
> </HTML>
>
>
> I connect to sql server by this
> <%
>   Dim strDatabaseType
>
>   'Choose one of the following two lines, and comment
> out the other
>   'strDatabaseType = "Access"
>   strDatabaseType = "MSDE"
>
>   'Now we use this selection to specify the connection
> string
>   If strDatabaseType = "Access" Then
>     strConnect = "Provider=Microsoft.Jet.OLEDB.4.0;" &
> _
>                  "Data
> Source=C:\datastores\Movie2000.mdb;" & _
>                  "Persist Security Info=False"
>   Else
>     strConnect = "Provider=SQLOLEDB;Persist Security
> Info=False;" & _
>                  "User ID=sa;Initial Catalog=Movie;" &
> _
>                  "Initial File
> Name=C:\MSSQL7\Data\Movie2000.mdf"
>   End If
> %>
>
> this is error which occurs
> Microsoft OLE DB Provider for SQL Server error
> '80004005'
>
>
> /begasp/addnew.asp, line 16
>
>

  Return to Index