PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
VS 2005 [RESOLVED] How to fill in my gridview-VBForums
Results 1 to 6 of 6

Thread: [RESOLVED] How to fill in my gridview

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member shyguyjeff's Avatar
    Join Date
    Jul 2007
    Location
    City of Durian
    Posts
    289

    Resolved [RESOLVED] How to fill in my gridview

    Hello everyone, I have here a code but my problem is that how can i add the value of the result in my gridview. Actually when I put msgbox to the "myString" it result 3 by 3 and that's what i want but the problem is that how can i call all of those strings to display on one column of gridview and each value from my database is beside them? Could anyone help me this? This is my code:


    Code:
      
    
    Dim CSCode As String = = "123456789"
    
    Dim myString As String 
                         
     For z As Integer = 0 To CSCode.Length - 1 Step 3
    
                    myString = CSCode.Substring(z, 3)
                    
    
    
                    Dim objConn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("database\myData.mdb") & ";")
    
                    Dim strSQL As String
                    strSQL = "SELECT Classification FROM Classification WHERE ClassCode LIKE '" & myString & "'"
    
    
                  
                    Dim objCmd As New OleDbCommand(strSQL, objConn)
                    Dim objDA As New OleDbDataAdapter()
                    objDA.SelectCommand = objCmd
    
                    objConn.Open()
    
    
    
                    Dim objDS As DataSet = New DataSet()
                    objDA.Fill(objDS, "Classification")
    
    
                    ClassGrid.DataSource = objDS
    
                    ClassGrid.DataBind()
    
    
                    objConn.Close()
    
                Next
    Thanks in advance.
    Last edited by shyguyjeff; May 13th, 2009 at 04:46 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width