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

  • Home
  • SEARCH
  • 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 1898206
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T06:44:15+00:00 2026-05-17T06:44:15+00:00

I am trying to insert an array into SQL with no luck. I get

  • 0

I am trying to insert an array into SQL with no luck. I get the string from a GPRS device that looks like this:

/WeightBridge.aspx?ReadeID=A1B5A0F5C4E4A1B5A0F5C4E4&TagID=45B6C56A90B645B6C56A90B6,A47B1256A45F0843,B49B1256A45F08FF,30 SEP 2010 21:33:59,I,&Custom=Vehicle Num

All I want to do is to split the TagID array and insert it with the rest of the string into a SQL table. The TagID array must inserted into the following colomns in the DB. TagID, TID, UserMemory, DateTime and Direction. After the insert I just give a response that the insert was successfull or failed. Thank you

My code this far:

Imports System.Data.Sql
Imports System.Data.SqlClient

Partial Class WeightBridge
    Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    insertValue()


End Sub
Private Sub insertValue()
    Dim sqlConn As New SqlConnection
    Dim strConnection As String
    Dim MyTagID As String
    Dim MyReaderID As String
    Dim MyCustom As String
    Dim MyTagArray As Array
    Dim i As Integer

    'Request TagID Array
    MyTagID = Request("TagID")
    If MyTagID.Length > 0 Then
        'Response.Write(MyTagID)
        'Split TagID Array 
        MyTagArray = Split(MyTagID, ",")
        For i = 0 To UBound(MyTagArray) - 1
        Next
    End If

    Try
    strConnection = "My Connection String"

    sqlConn = New SqlConnection(strConnection)
    Dim InsertCommand As New SqlCommand("INSERT INTO WeightBridge(ReaderID, TagID, TID, UserMemory, DateTime, Direction, Custom) VALUES ( '" & Request("ReaderID") & "', '0','0','0','0','0',  '" & Request("Custom") & "')", sqlConn)
    sqlConn.Open()

    InsertCommand.ExecuteNonQuery()

    sqlConn.Close()

    Catch ex As Exception
        Response.Write("FailedNo")
    End Try

    Response.Write("Success")

End Sub

End Class
  • 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. Editorial Team
    Editorial Team
    2026-05-17T06:44:15+00:00Added an answer on May 17, 2026 at 6:44 am

    There is a comma at the end of your TagID QueryString.

    Besides, have a look at following code:

    Dim allCols() As String = Request("TagID").Split(","c)
    Dim tagID As String = allCols(0)
    Dim tID As String = allCols(1)
    Dim usermemory As String = allCols(2)
    Dim dateTime As String = allCols(3)
    Dim direction As String = allCols(4)
    '........
    

    You should read this article because you are widely open for sql-injection attacks.

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

Sidebar

Related Questions

Currently I'm trying this: $sql_words = array(select,update,set, from, where, and, order by,insert into,delete); echo
I'm trying to insert variables from an SQL result into a HTML form in
I'm trying to insert array into database. Why don't this work? $array_zone = array();
Trying to build a function that can insert into a SQL database regardless of
I'm trying to insert into an array at a certain point: $hi = test;
I'm trying to insert an array of new contacts from a temporary import table
Trying to insert 315K Gif files into an Oracle 10g database. Everytime I get
im trying to insert this query with mysql_query INSERT INTO um_group_rights (`um_group_id`,`cms_usecase_id`,`um_right_id`) VALUES (2,1,1)
While trying to insert data to my SQl db i get the following error
I am trying to insert rows of data in an array into a table.

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.