123 Eng

Engineering the engineers™

Latest Jobs   Forum Map



Source Codes

Engineering Colleges

BE Students

Training  Reports (updated)

Seminar Reports (updated

Placement Papers (updated)


   Computer Science / IT






   CAT / MBA

   GMAT / Foreign MBA

Latest Jobs

Engineering Jobs / Technical Jobs

Management Jobs



Terms of use

Displaying  Source Code(s)  

Insert TEXT blob using ADO


Description : BLOB fields are large objects stored in binary format in a SQL server are allowed to be enormously large. This flexibility is offset by the fact that they are often difficult to deal with. This exmaple shows a simple form to insert a Text BLOB into a table using SQL Pass-thru. Make sure you name the form: SQLInsert.ASP

<%@ Language=VBScript %>
Option Explicit
Response.Expires = 0
' *****************************
' Variable Declarations
' *****************************
' Strings
' Integers & Numerics
' Objects
Dim cn, rs
' Other
' *****************************
' Initialize Variables
' *****************************
<!-- #INCLUDE Virtual="/include/ForceFrame.htm" -->
<TITLE>Insert using SPT (SQL pass-thru)</TITLE></HEAD>
<BASEFont Face="Verdana,Arial">
If Request.Form("TextCol") = "" Then
<FORM Action=SQLInsert.asp Method=Post>
<TEXTAREA Rows=10 Cols=45 Name=TextCol>This example uses SQL Pass-thru To insert
a record into a database. This method allows us To insert into BLOB fields such As
SQL Server Text fields, FoxPro Memo fields, Or other fields > 255 characters.
This has an embedded Single quote(') To show how these can be handled With
an SQL insert.</TEXTAREA><P>
<Input Type=Submit Name=btnSubmit Value="Submit">
Set cn = Server.CreateObject("ADODB.Connection")
cn.Open Application("guestDSN")
SQL = "INSERT INTO pubs..paulen (TextCol) "
SQL = SQL & " VALUES ('" & padQuotes(Request("TextCol")) & "')"
cn.Execute SQL
Response.Write "<B>Inserted:</B><BR>" & Request("TextCol")
End If
Function padQuotes( instring )
REM This Function pads an extra Single q
' uote in strings containing quotes for
REM proper SQL searching.
Dim bodybuild
Dim bodystring
Dim Length
Dim i
bodybuild = ""
bodystring = instring
Length = Len(bodystring)
For I = 1 To length
bodybuild = bodybuild & Mid(bodystring, I, 1)
If Mid(bodystring, I, 1) = Chr(39) Then
bodybuild = bodybuild & Mid(bodystring, I, 1)
End If
bodystring = bodybuild
padQuotes = bodystring
End Function



Contribute content or training reports / feedback / Comments
job placement papers
All rights reserved copyright 123ENG