Solved

SQL UPDATE with VB.Net SUBSTRINGS

Posted on 2011-03-11
2
239 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

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 …
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

708 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now