I already inserted 1 record to my existing database named "bundy_db"...
then i want to retrieve the lastname of my 1st record only and display it to my textbox but eventually it displayed something else...
This is the the statement that was displayed "Npgsql.NpgsqlDataReader"..
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Npgsql;
namespace WindowsApplication2
{
public partial class Form1 : Form
{
DateTime simple = new DateTime();
TimeSpan total = new TimeSpan();
NpgsqlConnection conn = new NpgsqlConnection("Server=localhost;Port=5432;User Id=postgres;Password=password;Database=bundy_db;");
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
conn.Open();
NpgsqlCommand command = new NpgsqlCommand("select l_name from staff_table", conn);
NpgsqlDataReader dr = command.ExecuteReader();
textBox2.Text = dr.ToString();
conn.Close();
}
can somebody help me on this??

New Topic/Question
Reply



MultiQuote


|