Click here to Skip to main content
15,891,513 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Can't find column 1 in dataTable that populates dataview then datagrid Pin
Dave Kreskowiak19-Mar-08 13:10
mveDave Kreskowiak19-Mar-08 13:10 
GeneralRe: Can't find column 1 in dataTable that populates dataview then datagrid Pin
AAGTHosting19-Mar-08 15:05
AAGTHosting19-Mar-08 15:05 
GeneralRe: Can't find column 1 in dataTable that populates dataview then datagrid Pin
Dave Kreskowiak20-Mar-08 5:01
mveDave Kreskowiak20-Mar-08 5:01 
GeneralRandom records Pin
bapu288919-Mar-08 10:04
bapu288919-Mar-08 10:04 
GeneralRe: Random records Pin
Christian Graus19-Mar-08 10:42
protectorChristian Graus19-Mar-08 10:42 
QuestionRe: Random records Pin
bapu288919-Mar-08 11:07
bapu288919-Mar-08 11:07 
GeneralRe: Random records Pin
Christian Graus19-Mar-08 22:05
protectorChristian Graus19-Mar-08 22:05 
QuestionRe: Random records Pin
bapu288919-Mar-08 22:51
bapu288919-Mar-08 22:51 
Hello sir
good morning

this is want i have done last night but still it's getting same questions again and again

but i will try your next command today but i dont know that i am going in to right direction

 Private Sub Display()<br />
        ' Open the database.<br />
        Dim conn As OleDbConnection = GetDbConnection()<br />
<br />
        ' See how many records there are.<br />
        Dim query As String = "SELECT COUNT(*) FROM MyTest"<br />
        Dim cmd As New OleDbCommand(query, conn)<br />
        Dim num_records As Integer = cmd.ExecuteScalar()<br />
        If txtNum.Text > num_records Then<br />
            MsgBox("Hello there is only " & num_records & "  records in database" & vbCrLf & _<br />
            "So please enter " & num_records & " or less then " & num_records, MsgBoxStyle.Exclamation)<br />
            Exit Sub<br />
        End If<br />
        ' Make an array to hold the selected indexes.<br />
        Dim num_random As Integer = num_records<br />
        Dim Asked(num_random) As Boolean<br />
        Dim indexes(num_random - 1) As Integer<br />
        Dim sorted_indexes As New SortedList(num_random - 1)<br />
        ' Generate the indexes.<br />
        Dim rand As New Random<br />
        Dim I As Integer<br />
        For I = 0 To num_random - 1<br />
            ' Generate the i-th index.<br />
            Dim new_value As Integer = rand.Next(0, num_records - I)<br />
<br />
            ' For each previously generated index <=<br />
            ' than this one, increment this one.<br />
            For j As Integer = 0 To I - 1<br />
                If sorted_indexes.GetByIndex(j) <= new_value Then<br />
                    new_value += 1<br />
                End If<br />
            Next j<br />
<br />
            ' Save tjhe new value.<br />
            indexes(I) = new_value<br />
            sorted_indexes.Add(new_value, new_value)<br />
        Next I<br />
        query = "SELECT * FROM MyTest " & "WHERE Index=?"<br />
        cmd = New OleDbCommand(query, conn)<br />
        Dim i2 As Integer<br />
        ' Fetch record i.<br />
        Dim index As Integer = indexes(i2)<br />
        cmd.Parameters.Clear()<br />
        cmd.Parameters.Add(New OleDbParameter("Index", index))<br />
        Dim reader As OleDbDataReader = cmd.ExecuteReader(CommandBehavior.SingleRow)<br />
        reader.Read()<br />
        lblA.Text = reader.Item(i2).ToString<br />
        ' Close the connection.<br />
        conn.Close()<br />
        conn.Dispose()<br />
    End Sub


thank you sir for your time Smile | :) Rose | [Rose]

have a nice day
Generalhiding mapped drive Pin
Cory Kimble19-Mar-08 9:41
Cory Kimble19-Mar-08 9:41 
GeneralRe: hiding mapped drive Pin
Dave Kreskowiak19-Mar-08 10:33
mveDave Kreskowiak19-Mar-08 10:33 
GeneralRe: hiding mapped drive Pin
Cory Kimble19-Mar-08 10:51
Cory Kimble19-Mar-08 10:51 
GeneralRe: hiding mapped drive Pin
Dave Kreskowiak19-Mar-08 11:11
mveDave Kreskowiak19-Mar-08 11:11 
GeneralRe: hiding mapped drive Pin
Cory Kimble24-Mar-08 4:37
Cory Kimble24-Mar-08 4:37 
GeneralRe: hiding mapped drive Pin
Dave Kreskowiak24-Mar-08 10:34
mveDave Kreskowiak24-Mar-08 10:34 
GeneralTwo simple questions I think Pin
cstrader23219-Mar-08 9:02
cstrader23219-Mar-08 9:02 
GeneralRe: Two simple questions I think Pin
Smithers-Jones19-Mar-08 9:17
Smithers-Jones19-Mar-08 9:17 
GeneralRe: Two simple questions I think Pin
cstrader23219-Mar-08 9:51
cstrader23219-Mar-08 9:51 
QuestionI hate reportviewer......isn't there something better!?!? Pin
Tom Wright19-Mar-08 8:45
Tom Wright19-Mar-08 8:45 
AnswerRe: I hate reportviewer......isn't there something better!?!? Pin
Dave Kreskowiak19-Mar-08 10:34
mveDave Kreskowiak19-Mar-08 10:34 
GeneralRe: I hate reportviewer......isn't there something better!?!? Pin
Tom Wright20-Mar-08 4:54
Tom Wright20-Mar-08 4:54 
GeneralRe: I hate reportviewer......isn't there something better!?!? Pin
Dave Kreskowiak20-Mar-08 4:59
mveDave Kreskowiak20-Mar-08 4:59 
AnswerRe: I hate reportviewer......isn't there something better!?!? Pin
darkelv22-Mar-08 18:38
darkelv22-Mar-08 18:38 
QuestionObject synchronization method was called from an unsynchronized block of code. Pin
RJGCarey19-Mar-08 8:07
RJGCarey19-Mar-08 8:07 
GeneralRe: Object synchronization method was called from an unsynchronized block of code. Pin
RJGCarey19-Mar-08 9:01
RJGCarey19-Mar-08 9:01 
GeneralUsing "wdPropertyTimeLastSaved" fon Userforms for Word. Pin
Harold_Wishes19-Mar-08 7:07
Harold_Wishes19-Mar-08 7:07 

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.