Rao Varrey

Rao Varrey

  • NA
  • 56
  • 3.1k

Can somebody help me to point out the errors in coding.

Sep 20 2017 3:24 AM
using System;
using System.Data.Odbc;
using System.Windows.Forms;

namespace SevenDROPS
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button2_Click(object sender, EventArgs e)
{
OdbcConnection myConnection = new OdbcConnection();
OdbcCommand cmd = myConnection.CreateCommand();
string myConnectionString = @"Driver={Microsoft Access Driver (*.mdb)};" + "Dbq=C:/DROPS-Data/Derrick.mdb";
{
myConnection.ConnectionString = myConnectionString;
myConnection.Open();
//execute queries, etc
cmd.CommandText = "SELECT * FROM InspInfo WHERE WONo = 'DROP-001'";
OdbcDataReader reader = cmd.ExecuteReader();

//textBox1.Text = "Transocean Offshore"; //reader.GetString(1);
textBox1.Text = reader["CompanyName"].ToString();
}
 
 
The field value is not getting displayed....Error it says "No data exists for the row / column" 

Answers (1)