Using VBScript Functions In CodeBehind

Results 1 to 2 of 2

Thread: Using VBScript Functions In CodeBehind

  1. #1
    Join Date
    Dec 1969

    Default Using VBScript Functions In CodeBehind

    I am using the following CodeBehind to retrieve & display records from a backend:<BR><BR>Imports System<BR>Imports System.Web<BR>Imports System.Web.UI<BR>Imports System.Web.UI.WebControls<BR>Imports System.Data<BR>Imports System.Data.SQLClient<BR>Imports System.Drawing.Color<BR><BR>Public Class CodeBehind1 : Inherits Page<BR> public dGrid As DataGrid<BR> public headerLabel As Label<BR> public mainPlaceHolder As PlaceHolder<BR><BR> Dim strLOption,strEmp,strEName,arrEName,strEachEmp,str Each<BR><BR> Sub Page_Load(obj As Object,ea As EventArgs)<BR> strLOption=Request.QueryString("loption")<BR> strEmp=Request.QueryString("emp")<BR> strEName=Request.QueryString("ename")<BR><BR> If(strLOption="admin") Then<BR> If(strEmp="selemp") Then<BR> arrEName=Split(strEName,",")<BR> For Each strEachEmp In arrEName<BR> strEach=strEach & "&#039;" & Trim(strEachEmp) & "&#039;,"<BR> Next<BR> strEach=Left(strEach,Len(strEach)-1)<BR> End If<BR> End If<BR> ........................<BR> End Sub<BR>End Class<BR><BR>Now when the above code is executed, I am getting the following error:<BR><BR>&#039;Split&#039; is not declared.<BR><BR>which points to the arrEName=Split(strEName,",") line. Can&#039;t any VBScript functions be used in any codebehind sub-routine? How do<BR>I overcome this error? Not only this, I am even using some VBScript string functions like Right(), Mid() etc. in the SQL query as well!!! If giving an example, please do so using VB.NET (& not C#).<BR><BR>Thanks,<BR><BR>Arpan

  2. #2
    Join Date
    Dec 1969

    Default RE: Using VBScript Functions In CodeBehind

    Why not use the methods of the string class that .NET framework provides???? for example:<BR><BR>strEName.Split(", ".ToCharArray())<BR><BR>Well if you want to stick with VB functions, try adding<BR>"Imports Microsoft.VisualBasic"

Posting Permissions

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