?
Solved

please explain this insert statement...it works, but i have never seen it before

Posted on 2004-11-16
1
Medium Priority
?
223 Views
Last Modified: 2010-04-23

Dim Qry as String
Dim NumberOfRows As Integer=100 '----------> FOR 100 ROWS
Dim NumberOfColumns As Integer=8 '---------> FOR A through H Seats
Dim PlaneID as String="3434278231"
Dim SeatType as String

For i=1 to NumberOfRows
    For j=1 to NumberOfColumns
        If j=1 Or J=8 Then
            'Assuming A & H are Window Seats
            SeatType="Window"
        Else
           'More If Blocks might come here as per Seating arrangement
           SeatType="Aisle"
        End If
        Qry=String.Format("INSERT INTO TBL_SEAT (SEAT_NUM, SEAT_ROW, SEAT_TYPE, PLANE_ID) VALUES ('{0}', {1},'{2}', '{3}');",Chr(64+j),i,SeatType,PlaneID)

    Next j
Next i

what does this part do:
 ('{0}', {1},'{2}', '{3}');",Chr(64+j)
0
Comment
Question by:NickUA
1 Comment
 
LVL 24

Accepted Solution

by:
Jeff Certain earned 2000 total points
ID: 12597308
('{0}', {1},'{2}', '{3}');",Chr(64+j),i,SeatType,PlaneID) inserts Chr(64+j) into {0}, i into {1}, etc... allows you to easily put the values of the calculations/methods into the spots where {x} appear.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…

807 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