Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

SQL UPDATE with VB.Net SUBSTRINGS

Posted on 2011-03-11
2
Medium Priority
?
247 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 47

Accepted Solution

by:
Wayne Taylor (webtubbs) earned 2000 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
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…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

670 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