douyi8732 2015-03-08 08:44
浏览 192


I don't know if this is even possible, and I can't figure how to achieve this.

I have 50 (can be more) records in MS Access database that I wish to send to a a php file at my server for further processing.

What I have implemented so far is that I loop through the records and send them one by one. This kind of takes time cause of network issues, some records will be sent and others won't and each data sent will have to wait for report from server before the next one will be sent.

Is there a way I can send all records once, maybe in an array or something and be able to access it at the server side?

Below is my table schema.

|  id  |  phone  |  msg  |
|  1   | 09023023|  hi   |
|  2   | 09023024|  hey  |
|  3   | 09023025|  dear |  


  • 写回答

2条回答 默认 最新

  • douchuose2514 2015-04-15 10:37

    I found a solution for this. I don't know if it is the best way out there but it worked well.

    On @Tushar Gupta suggestion, I created a Json Array using a third party Json Library found at

    I looped through the data in the database and concatenated them like so:


        Dim sms As New Sms 'note that this is a class
        Dim sms_obj As String = ""
            Dim cmd As OleDbCommand = New OleDbCommand("id, phone, msg FROM sms;", conn)
            Dim reader As OleDbDataReader = cmd.ExecuteReader
            'collate sms
            Dim i As Integer = 0
            While reader.Read()
       = reader("id").ToString()
                sms.member_phone = reader("phone").ToString()
                sms.member_message = reader("msg").ToString()
                If sms_obj = "" Then
                    sms_obj = sms_obj + JsonConvert.SerializeObject(sms, Formatting.Indented)
                    sms_obj = sms_obj + "," + JsonConvert.SerializeObject(sms, Formatting.Indented)
                End If
            End While
            sms_obj = "{ ""sms""" + ":" + "[" + sms_obj + "]}" ' this put the json string in an array
            'close the connection
            If sms.ToString <> "" Then
            End If
            lblSmsState.Text = "sending sms done!"
        Catch ex As Exception
        End Try


        { "sms":[
                "id": "1",
                "member_phone": "09023023",
                "member_message": "hi"
                "id": "2",
                "member_phone": "09023024",
                "member_message": "hey"
                "id": "3",
                "member-phone": "09023025",
                "member_message": "dear"
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
  • dqc2017 2015-03-24 00:27

    not sure what you are exactly trying to achieve but you could use MYSQL or phpmyAdmin

    you could also in the excel file add $id = ( at the top of the column and then use commas to separate the records (<kbd>CTRL + F</kbd> replace may be useful) and end the column with );. You may want to follow the same procedure with phone and msg too, then save the file as a CSV or make it into single line or perhaps copy the data in your text editor and that should save it as an array.

    php also makes use of multi dimensional array, which you can read up and can store everything in one array (not recommended as not efficient).




  • ¥15 Erasure Code纠删码表
  • ¥15 用vite创建的vue3项目,404重定向不起作用??
  • ¥15 关于#c语言#的问题:一个球从80米高度自由落下,每次落地后反弹的高度为原高度的一半计算6次小球反弹的高度.(反弹结果取整,使用走走for循环结构)
  • ¥15 SurfaceControl的screenshot问题
  • ¥15 基于51单片机的oled菜单代码,要C语言,模块化编程!
  • ¥15 JAVAswing,设计一个扑克牌什么的
  • ¥50 python ctypes调用dll实现分析
  • ¥40 用python解决数据统计问题
  • ¥100 是否有方案能通过抓包分析得到移动应用的名称和包名信息?
  • ¥15 opencv检测不到轮廓