HELP! Sending data from postgresql to c#

retrieving a record from postgresql to c#

Page 1 of 1

0 Replies - 1207 Views - Last Post: 02 February 2009 - 08:43 PM Rate Topic: -----

#1 nagajanico   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 02-February 09

HELP! Sending data from postgresql to c#

Posted 02 February 2009 - 08:43 PM

Im having runtime problems of my program because after i connected my c# project to postgresql..

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()


		private void Form1_Load(object sender, EventArgs e)
			NpgsqlCommand command = new NpgsqlCommand("select l_name from staff_table", conn);

			NpgsqlDataReader dr = command.ExecuteReader();

			textBox2.Text = dr.ToString();


can somebody help me on this??

Is This A Good Question/Topic? 0
  • +

Page 1 of 1