Solved

SQL UPDATE with VB.Net SUBSTRINGS

Posted on 2011-03-11
2
241 Views
Last Modified: 2012-08-13
Hello Experts,

I'm wanting to UPDATE the Sequence field in a SQL Server 2008 table by using the Index of a listbox +1. I want to use the first characters in the strings that populate the listbox as the JOIN criteria. Something like :
"UPDATE tblQuestionnaire SET Sequence = '" & intSeq & "'" & _
                    "WHERE Q_Key = '" & intQ_Key & "'"
Except as a loop through all the records selected in the listbox (lbQuestions) and intQ_Key as the first characters.
The strings in the listbox are like:
385, Does yada yada yada?
257, Is yada yada yada?
1564, Can it yada yada yada?

So I need a way to grab the numbers to the left of the comma. Any ideas?

Thanks in advance,

JackW9653



0
Comment
Question by:JackW9653
2 Comments
 
LVL 47

Accepted Solution

by:
Wayne Taylor (webtubbs) earned 500 total points
ID: 35113619
To get the numbers to the left of the comma, you can use the String.Split function....

    intQ_Key = lbQuestions.Items(intSeq).ToString.Split(","c)(0)

Open in new window


Wayne
0
 

Author Closing Comment

by:JackW9653
ID: 35113771
Thank you very much.
JackW9653
0

Featured Post

ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

Question has a verified solution.

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

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 …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

810 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