Error with access and vb when I try to create a new row in the db via vb

Lenjaku

New member
Joined
Mar 7, 2011
Messages
2
Programming Experience
Beginner
It gives me an syntax error in the INSERT INTO statement.

Telling me :"In order to evaluate an indexed property, the property must be qualified and the arguments must be explicitly supplied by the user."

error code:-2147217900

My daclarations:
Private m_cnadonetconnection As New OleDb.OleDbConnection
Private m_cbcommandbuilder As OleDb.OleDbCommandBuilder
Private m_players As New DataTable
Private m_rowposition As Integer = 0
Private m_dataadapter As New OleDb.OleDbDataAdapter


The error sub which drived the error:

Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
Dim drnewrow As DataRow = m_players.NewRow()
drnewrow(0) = 20
drnewrow(1) = TextBox1.Text
drnewrow(2) = 1
drnewrow(3) = 2
drnewrow(4) = 3
drnewrow(5) = 4
m_players.Rows.Add(drnewrow)
TextBox3.Text = m_players.Rows(m_rowposition)(
"Player_id").ToString
m_dataadapter.Update(m_players)
End Sub


I got 6 fields in my access:

player_id (int) (already tried to make it auto number so I dun enter a value via vb
but this failed as well)
player (string)

score(long int)
wins(int)
loses(int)
avg(short)


Id is set to 20 for debugging, I dun intend of entering the same index over and over ofcourse...
If could I'd like that to be auto...

I can;t seem to find the cause of this problem and 2 teachers/instructors at my college failed at that as well and told me to leave it and not create a new row....but then how can I delete them -.-
What's the point of such db....they are not very smart apparently....taht's sad.
 
Back
Top