私のデータベースには、time、strike、vol の 3 つの列があります。たとえば、2 列目の 3 番目の値を取得できません。どの列の最初の値しか取得できません。
私が望むのは、たとえば 2 列目の 3 番目の値を別の変数に格納してから、いくつかの計算を続行することです。つまり、指定された列の特定の場所でいくつかの値を取得する必要があります。
どんな助けでも大歓迎です。
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string ConnStr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Users\\mike\\Documents\\Database1.mdb;";
OleDbConnection MyConn = new OleDbConnection(ConnStr);
MyConn.Open();
string StrCmd = "SELECT * FROM Table1";
OleDbCommand Cmd = new OleDbCommand(StrCmd, MyConn);
OleDbDataReader ObjReader = Cmd.ExecuteReader();
string VolT0;
string VolT1;
string VolK0;
string VolK1;
if (ObjReader != null)
{
while (ObjReader.Read())
{
VolT0 = ObjReader.GetValue(1).ToString();
VolK0 = ObjReader.GetValue(2).ToString();
//VolK1 = ObjReader.GetValue(2).ToString(); //here is the problem: here I need to get the 3rd value in this column but it's not working !
Console.WriteLine(VolT0 + " - " + VolK0 + "\n");
}
}
ObjReader.Close();
MyConn.Close();
}
}
}