Results 1 to 5 of 5

Thread: Visual basic 2008 Info System Need Help on my PORBLEM PLEASE :(

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2011
    Posts
    2

    Visual basic 2008 Info System Need Help on my PORBLEM PLEASE :(

    hello good day im a 2nd yr it student doing my program thesis an info sytem about a police station.. now i got a problem in on of my procedure Create_Table
    this is a part of my CRUD

    Code:
    Private Sub Create_Table()
            dt = New DataTable("Temp")
            cmd = New OleDbCommand("Select from InmateInfo", cn)
            cn.Open()
            dr = cmd.ExecuteReader
            dt.Clear()
            For i = 0 To dr.FieldCount - 1
                dt.Columns.Add(dr.GetName(i), dr.GetFieldType(i))
            Next
            While dr.Read
                Dim drw As DataRow = dt.NewRow
                For i = 0 To dr.FieldCount - 1
                    drw(i) = dr(i)
                Next
                dt.Rows.Add(drw)
            End While
            dr.Close()
            cn.Close()
            DataGridView1.DataSource = dt
    my dr = cmd.ExecuteReader always shows an error every time i click my form.. .anyone can help and show my mistakes?
    Last edited by gep13; Mar 22nd, 2011 at 02:27 AM. Reason: Added Highlight Tags

  2. #2
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Visual basic 2008 Info System Need Help on my PORBLEM PLEASE :(

    Hello kram2by4,

    Welcome to the Forums!

    When you are posting code into the forum, can you please remember to surround it in [code][/code] or [HIGHLIGHT=vb][/highlight] tags? It makes it a lot easier to read. I have done this for you in your above post.

    Thanks

    Gary

  3. #3

    Thread Starter
    New Member
    Join Date
    Mar 2011
    Posts
    2

    Re: Visual basic 2008 Info System Need Help on my PORBLEM PLEASE :(

    Quote Originally Posted by gep13 View Post
    Hello kram2by4,

    Welcome to the Forums!

    When you are posting code into the forum, can you please remember to surround it in [code][/code] or [HIGHLIGHT=vb][/highlight] tags? It makes it a lot easier to read. I have done this for you in your above post.

    Thanks

    Gary
    newbie here sorry... il keep it in mind next time....
    Last edited by gep13; Mar 22nd, 2011 at 02:55 AM.

  4. #4
    PowerPoster cicatrix's Avatar
    Join Date
    Dec 2009
    Location
    Moscow, Russia
    Posts
    3,654

    Re: Visual basic 2008 Info System Need Help on my PORBLEM PLEASE :(

    The word 'Error' is very ambiguous, really it doesn't say anything. You should have provided an exact error message. An error message usually tells us what is wrong. If only people read them.
    Anyway, your SQL command has a syntax error:

    Code:
    SELECT what? FROM InmateInfo;
    Either there should be an asterisk * or a comma-separated list of fields to select.

  5. #5
    PowerPoster
    Join Date
    Mar 2002
    Location
    UK
    Posts
    4,780

    Re: Visual basic 2008 Info System Need Help on my PORBLEM PLEASE :(

    Please also give your title a meaningful name, we understand you want help as you have made a post so no need to put that in the title! Something like ExecuteReader problem, or sql database help gives people a chance to find posts on the same subject later.

Posting Permissions

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



Click Here to Expand Forum to Full Width