If you check the documentation -
SqlDataReader.GetInt32(Int32) Method (System.Data.SqlClient) | Microsoft Docs[
^] - it will show you
Quote:
public override int GetInt32 (int i);
Parameters
i Int32 The zero-based column ordinal.
You are using a string in your code
... AddXY(READER.GetInt32("ID"), ...
Note you will have the same problem with
GetString
.
You are also returning all of the columns from your table with
"SELECT * FROM TECH_PORUCHY"
It is better practice to explicitly list the columns you want to return - it also makes code using
GetInt32
etc easier to read.E.g.
Dim DOTAZ As String = "SELECT ID, VIDENCNI_CIS FROM TECH_PORUCHY"
.
.
.
Chart1.Series("GRAF_PORUCH").Points.AddXY(READER.GetInt32(0), READER.GetString(1))