using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Data.OleDb; namespace Spelling_Bee_Retry { public partial class Student_Test : Form { public Student_Test() { InitializeComponent(); } OleDbCommand cmd = new OleDbCommand(); OleDbConnection con = new OleDbConnection(); OleDbDataAdapter da; DataSet ds; DataRow dRow; int maxRows; Database_Connection objConnect = new Database_Connection(); private void Student_Test_Load(object sender, EventArgs e) { con.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source= Spelling Bee.accdb";//creates a connection with my access database cmd.Connection = con; con.Open(); cmd.CommandText = "SELECT * FROM " + globalVariables.testName;//selects the testname according to my tablename from combobox cmd.ExecuteNonQuery(); OleDbDataReader dr = cmd.ExecuteReader(); if (dr.Read()) { //These are my textboxes. The first textbox displays the information from the first row from the column, but the rest I can't figure it out. defbx1.Text = dr.GetValue(1).ToString(); defbx2.Text = dr.GetValue(1).ToString(); } con.Close(); }
cmd.ExecuteReader()
reader.Read()
reader.Read() defbx1.Text = dr.GetValue(1).ToString(); reader.Read() defbx2.Text = dr.GetValue(1).ToString(); ...
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)