SQL UPDATE with VB.Net SUBSTRINGS
Posted on 2011-03-11
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,