Access database valid chars?

Ontani

Well-known member
Joined
Mar 3, 2004
Messages
119
Location
Belgium
hey im working on a vb.net project.
everything works fine but for 1 thing.
i connect to my database, try to insert a value and try to get it back later.
this all works except for 1 value.

when my value has the chars ][ in it.

the values are all player names and some have ][ for a T.
How can i still put these names in my database and get them back out.

im currently using:

Code:
Dim MyCommand As New OleDbCommand("INSERT INTO playerStats (playerName, playerFrags, playerDeaths, playerHeadshots) VALUES (" & Player & ", 1, 0, 0)", MyConnection)
MyCommand.ExecuteNonQuery()
MyCommand.Dispose()

And

Code:
Dim playerFrags, playerDeaths, playerHeadshots As String
Dim MyCommand As New OleDbCommand("SELECT * FROM playerStats WHERE playerName = " & Player & "", MyConnection)
Dim MyReader As OleDbDataReader = MyCommand.ExecuteReader()
While MyReader.Read
   playerFrags = MyReader("playerFrags")
   playerDeaths = MyReader("playerDeaths")
   playerHeadshots = MyReader("playerHeadshots")
End While
MyReader.Close()
MyCommand.Dispose()

Greetz

PS: i dont want to replace the ][ by a T cause maybe other names have somesort of unvalid chars in it.
 
Back
Top