Solved

array syntax help please

Posted on 2004-10-19
2
203 Views
Last Modified: 2008-03-03
Hi There,

I am trying convert a function that I was using in asp to asp .net, I keep getting the error "overload resolution failed because no accessable 'create instance' can be called without a narrowing conversion". What have I missed?

Sean

    Public Shared Function killChars(ByVal strWords As String)

        Dim newChars As String
        Dim i As Integer

        Dim badChars As Array = Array.CreateInstance(GetType(String), "select", "drop", ";", "--", "insert", "delete", "xp_", "execute")
        newChars = strWords

        For i = badChars.GetLowerBound(0) To badChars.GetUpperBound(0)
            newChars = Replace(newChars, badChars(i), "")
        Next

        killChars = newChars

    End Function
0
Comment
Question by:bullrout
[X]
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
2 Comments
 
LVL 28

Accepted Solution

by:
mmarinov earned 500 total points
ID: 12346476
Hi bullrout,

as i see from the definition of the CreateInstance in MSDN you can not do that for string objects
have you tried this

Dim badChars() as String = { "select", "drop", ";", "--", "insert", "delete", "xp_", "execute" }

Regards!
B..M
0
 
LVL 5

Author Comment

by:bullrout
ID: 12356175
Works like a treat thanks BM.

Sean
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

636 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