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?
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
Re: Visual basic 2008 Info System Need Help on my PORBLEM PLEASE :(
Quote:
Originally Posted by
gep13
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....
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.
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.