Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Fetching data from TEXT-field through ASP

Posted on 1998-07-08
3
242 Views
Last Modified: 2010-03-19
In asp, how can I read a field with the datatype TEXT?
0
Comment
Question by:ribbegrd
  • 2
3 Comments
 
LVL 28

Expert Comment

by:sybe
ID: 1091682
Supposing you have a connection named Conn:

<%
Set RS = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT field_name FROM table WHERE.... ORDER BY...."
RS.Open strSQL, Conn, 1, 1

field_contents = RS("field_name")

%>

It is important that you create the recordset this way and not (as works in Access) with:

<%
strSQL = "SELECT..etc"
Set RS = Conn.Execute(strSQL)
%>
In SQL this gives problems with text fields


0
 

Author Comment

by:ribbegrd
ID: 1091683
<%
set Conn=server.createobject("adodb.connection")
Set RS = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT * FROM people WHERE pwd = " & "'" & Request.ServerVariables("LOGON_USER")& "'"
RS.Open strSQL, Conn, 1, 1
field_contents = RS("fnamn")
response.write field_contents
RS.Close
%>

This results in the following error:
"ADODB.Recordset error '800a0e7d'

The application requested an operation on an object with a reference to a closed or invalid Connection object.

/showroom/admin/insert2.asp, line 23"

Line 23 is "RSE.Open strSQL, Conn, 1, 1"

Any ideas?
0
 
LVL 28

Accepted Solution

by:
sybe earned 100 total points
ID: 1091684
You don't have a connection, you only create the Conn object, but you should call the ODBC connection to the database:

<%
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "DSN=ODBC_Name;SERVER:SQL-Server_Name;UID=sa;PWD=;APP=;DATABASE=Database_Name"

etc etc.

Of course you should make an ODBC connection to the database


0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question