Skip site navigation (1) Skip section navigation (2)

Build new table using VB.NET in PostgreSQL

From: Mohd Rizal Md Noor <ezalampunk(at)gmail(dot)com>
To: pgsql-odbc(at)postgresql(dot)org
Subject: Build new table using VB.NET in PostgreSQL
Date: 2009-08-18 14:25:30
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-odbc
Hello all..i'm want to know why my program not work.I want built new table
in PostgreSQL using VB.NET but that code not work.only click one button new
table existed in my PostgreSQL.Please tell me what wrong at my program and
how to improve it?

Imports System
Imports System.Data
Imports System.Data.Odbc

Public Class Form1

  Dim thisConnection As New OdbcConnection _
  Dim nonqueryCommand As OdbcCommand = thisConnection.CreateCommand()

  Public sConnection As String = "DSN=PostgreSQL30;UID=tele;PWD=tiny;"
  Public cnDB As New Odbc.OdbcConnection(sConnection)

  Public dsDB As New DataSet
  Public adDB As New Odbc.OdbcDataAdapter

  Private Sub Button1_Click(ByVal sender As System.Object, _
  ByVal e As System.EventArgs) _
  Handles Button1.Click
  nonqueryCommand.CommandText = "CREATE TABLE mytable " & _
  "(MyName VARCHAR (30), MyNumber INTEGER)"
  'Console.WriteLine("Executing {0}", _
  ' nonqueryCommand.CommandText)
  'Console.WriteLine("Number of rows affected : {0}", _
  ' nonqueryCommand.ExecuteNonQuery())
  'adDB.SelectCommand = New Odbc.OdbcCommand(" CREATE TABLE
sensor_result_test ")

  MsgBox("Connect to Database", MsgBoxStyle.Information, "Success")
  Catch ex As Exception
  MsgBox("Connection to database Failed", MsgBoxStyle.Critical, "Action
  End Try

  End Sub

End Class

why new table not existed in my postgresql?please help me.tq.

pgsql-odbc by date

Next:From: Rainer BauerDate: 2009-08-18 19:45:48
Subject: Re: Savepoints in ODBC driver
Previous:From: Assaf LavieDate: 2009-08-17 12:58:52
Subject: Pre-Built Binaries of psqlODBC for 64-bit Windows

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group