Submitting String to SQL Server.

Results 1 to 3 of 3

Thread: Submitting String to SQL Server.

  1. #1
    RajSekhar Guest

    Default Submitting String to SQL Server.

    Hi,<BR><BR>I am facing problem while inserting a record with String values. The string may contain the character &#039 which is not allowed by SQL Server..? <BR><BR>Any inputs how to over come the prob..<BR><BR>Regards,<BR>Sekhar<BR>sekh_p@yahoo.c om

  2. #2
    Igal Vorobeychik Guest

    Default Use Parameters

    Set mobjCMProjectInsert=Server.CreateObject("ADODB.Com mand") <BR>&#039Set Active Connection to declared connection in include file<BR>mobjCMProjectInsert.ActiveConnection =objcn <BR>&#039If it is Adding Mode building the insert sql<BR>mobjCMProjectInsert.Commandtext = " INSERT INTO "&_<BR>"OriginalProject(ProjectId,ProjectName) " &_ <BR>" VALUES ((?) , (?))"<BR><BR>&#039First parameter is gnProjectId - integer - input<BR>mobjCMProjectInsert.Parameters.Append &_<BR>mobjCMProjectInsert.CreateParameter&_<BR> ("ProjectId",adInteger,adParamInput,4)<BR>&#039 Put to gnProjectId the value received from SP<BR>mobjCMProjectInsert("ProjectId") = gnProjectId <BR>mobjCMProjectInsert.Parameters.Append &_<BR>mobjCMProjectInsert.CreateParameter&_<BR>("P rojectName",adVarChar,adParamInput,100) <BR>mobjCMProjectInsert("ProjectName") =Request.Form("PName")<BR>&#039Executing Add/Edit<BR>mobjCMProjectInsert.Execute <BR>Set mobjCMProjectInsert=nothing <BR>

  3. #3
    anamika Guest

    Default RE: Submitting String to SQL Server.

    Pass the string to function wihile inserting, where the character &#039 is inserted as it ASCII values. this works fine with oracle. try it out with Sql Server<BR><BR>&#060;%<BR> Function Purify(cString)<BR> if cString &#060;&#062; "" then<BR> cString = Replace(cString,"&#039","&#039&#124&#124chr(39)&#1 24&#124&#039")end if<BR> Purify = cString<BR> End Function<BR>%&#062;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts