Click here to Skip to main content
16,021,209 members
Home / Discussions / Database
   

Database

 
GeneralRe: How do you handle Dev DB vs Production DB? Pin
programmervb.netc++29-Mar-10 18:35
programmervb.netc++29-Mar-10 18:35 
AnswerRe: How do you handle Dev DB vs Production DB? Pin
Mycroft Holmes29-Mar-10 18:54
professionalMycroft Holmes29-Mar-10 18:54 
QuestionDatabase design question Pin
Alivemau529-Mar-10 4:00
Alivemau529-Mar-10 4:00 
AnswerRe: Database design question Pin
J4amieC29-Mar-10 4:56
J4amieC29-Mar-10 4:56 
GeneralRe: Database design question Pin
Alivemau529-Mar-10 5:01
Alivemau529-Mar-10 5:01 
GeneralRe: Database design question Pin
J4amieC29-Mar-10 5:17
J4amieC29-Mar-10 5:17 
GeneralRe: Database design question Pin
Alivemau529-Mar-10 6:24
Alivemau529-Mar-10 6:24 
GeneralRe: Database design question Pin
programmervb.netc++29-Mar-10 9:11
programmervb.netc++29-Mar-10 9:11 
Alivemau5 wrote:
With (2) you wouldn't know which one is each..

You could know which one is which this is how we do it.
This may not be the cleanest way but it is very easy to maintain.
We create an integer array such as Dim blah() as Integer and set a default size for it close to what we think the number of records will be to minimize the use of redim.
Then do something like this with the record set you retrieve.


While myReader.Read
            cmbControl.Items.Add(myReader.GetString(1))
            lKeyIndex(lIndex) = myReader.GetValue(0)
            '
            lIndex += 1
            ' see if we need to redimension the array...
            If lIndex Mod iCurrentDim = 0 Then
                iCurrentDim = iCurrentDim + iDefaultDim
                ReDim Preserve lKeyIndex(iCurrentDim)
            End If
End While


Here is a example query.

SELECT `UniqueNumber`, `Description` FROM `ct_contsources_master` WHERE `Inactive` = 0 ORDER BY `Description`


Notice the Inactive flag...
If you use this than if a row is no longer valid you can set it to 1...therefore not populate the combo.

EDIT..
Oh yeah this will help..

Public Function fiSetComboIndex(ByVal lKey As Long, ByRef cboControl As ComboBox, ByRef lKeyIndex() As Long) As Integer
       ' this routine sets the current "SelectedIndex" to the lKey passed in...
       Dim iII As Integer
       Dim iKeyIndexLength As Integer = lKeyIndex.Length - 1
       '
       fiSetComboIndex = 0
       For iII = 0 To iKeyIndexLength
           If lKeyIndex(iII) = 0 And iII > 0 Then
               Exit For
           End If
           If lKeyIndex(iII) = lKey Then
               fiSetComboIndex = iII
               Exit For
           End If
       Next
   End Function


Use this to get the value that is selected.

blah(comboBoxName.SelectedIndex)

Store the result of that in the main table.
Humble Programmer

AnswerRe: Database design question Pin
riced29-Mar-10 5:57
riced29-Mar-10 5:57 
GeneralRe: Database design question Pin
Alivemau529-Mar-10 6:30
Alivemau529-Mar-10 6:30 
AnswerRe: Database design question Pin
Eddy Vluggen29-Mar-10 7:01
professionalEddy Vluggen29-Mar-10 7:01 
AnswerRe: Database design question Pin
programmervb.netc++29-Mar-10 8:53
programmervb.netc++29-Mar-10 8:53 
AnswerRe: Database design question Pin
PIEBALDconsult29-Mar-10 18:12
mvePIEBALDconsult29-Mar-10 18:12 
GeneralRe: Database design question Pin
Alivemau530-Mar-10 10:44
Alivemau530-Mar-10 10:44 
GeneralRe: Database design question Pin
PIEBALDconsult30-Mar-10 12:09
mvePIEBALDconsult30-Mar-10 12:09 
Questionhow to check this date is 6 months or 1 year for given condition Pin
developerit29-Mar-10 3:55
developerit29-Mar-10 3:55 
AnswerRe: how to check this date is 6 months or 1 year for given condition Pin
Eddy Vluggen29-Mar-10 7:08
professionalEddy Vluggen29-Mar-10 7:08 
QuestionSQL Query Pin
dabuskol29-Mar-10 2:10
dabuskol29-Mar-10 2:10 
AnswerRe: SQL Query Pin
Michael J. Eber29-Mar-10 11:26
Michael J. Eber29-Mar-10 11:26 
QuestionIs this query bad.....? Pin
Hum Dum29-Mar-10 1:18
Hum Dum29-Mar-10 1:18 
AnswerRe: Is this query bad.....? Pin
PSK_29-Mar-10 1:30
PSK_29-Mar-10 1:30 
GeneralRe: Is this query bad.....? Pin
programmervb.netc++29-Mar-10 9:24
programmervb.netc++29-Mar-10 9:24 
GeneralRe: Is this query bad.....? Pin
PSK_29-Mar-10 17:26
PSK_29-Mar-10 17:26 
AnswerRe: Is this query bad.....? Pin
Don Burton29-Mar-10 9:25
Don Burton29-Mar-10 9:25 
QuestionTables in database. Pin
MathewPV29-Mar-10 0:57
MathewPV29-Mar-10 0:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.