Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 139373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T07:25:23+00:00 2026-05-11T07:25:23+00:00

I have the following vb.net code to take the values out of a textbox

  • 0

I have the following vb.net code to take the values out of a textbox on a webpage (actually space delimited tags) and split them with a space delimiter into an array. This works exactly how I want.

mySample.Tags = tagsTextBox.Text Dim tags As String = mySample.Tags Dim tagarray() As String Dim count As Integer tagarray = tags.Split(' ') For count = 0 To tagarray.Length - 1 Next 

My issue is that I don’t know how to take each of the values in the array, after this code runs, to insert them as separate records in a table.

I also will not know how many items will be in the array.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T07:25:24+00:00Added an answer on May 11, 2026 at 7:25 am

    As Ian said this may be vurnerable for Sql injections. At the very least you should do a Server.HtmlEncode() for each tag you want to insert.

    To insert your data you could do the following:

    using (SqlConncetion conn = new SqlConnection(connstring)) using (SqlCommand cmd = conn.CreateCommand()) {    cmd.CommandText = 'INSERT INTO table(tag) values (@tag)';   cmd.Parameters.Add('@tag', SqlDbType.VarChar);    conn.Open();    foreach(string tag in tags)   {     cmd.Parameters['@tag'].Value = Server.HtmlEncode(tag);     cmd.ExecuteNonQuery();   } } 

    This should work properly, but doing it in a stored procedure and you should be safe against sql injections since you use parameters.

    Also you should see here for a discussion around the use of parameters.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following asp.net code but it gives error when I change dropdown selected
I have ASP.Net code similar to the following (this is inside a FIELDSET): <ol>
Anything I have tried didn't work. Currenly I have following code to change asp.net
I have the following code inside my asp.net-mvc project: private string GenerateEmail(RequestContext requestContext) {
I have the following code in my ASP.NET project public sealed class IoC {
I have the following code in a full .NET framework solution: public delegate int
i have the following code in an asp.net mvc view. <% = Html.DropDownList(Filter, new
I have the following code: http://jsfiddle.net/uRCL2/1 At the moment the result is shown in
I have the following code in a ASP.NET master page: <div id=hyperlinkimage><asp:HyperLink ID=SomeHyperLink runat=Server
I have the following php code from php.net <?php // The i after the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.