<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1528" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Managed to finally get data moving from my VB.Net 
into a PostGIS database last night :)</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I turned to npgsql which did an excellent job (and 
used less code) than other types of connectors. Below is some simple code I got 
working to insert a waypoint into a PostGIS database</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT size=2><FONT face=Arial><FONT 
size=2></FONT></FONT></FONT> </DIV>
<DIV><FONT size=2><FONT face=Arial><FONT size=2>Imports System<BR>Imports 
System.Data<BR>Imports Npgsql</FONT></FONT></FONT></DIV>
<DIV><FONT size=2><FONT face=Arial></FONT></FONT> </DIV>
<DIV><FONT size=2><FONT face=Arial>Private Sub 
Insert_Waypoints()</FONT></FONT></DIV>
<DIV><FONT size=2><FONT face=Arial>        Dim 
conn As Npgsql.NpgsqlConnection<BR>        
Dim command As 
Npgsql.NpgsqlCommand<BR>        Dim SQLStr As 
String<BR>        Dim rowsaffected As 
Int32</FONT></FONT></DIV>
<DIV><FONT size=2><FONT face=Arial></FONT></FONT> </DIV>
<DIV><FONT size=2><FONT face=Arial> </DIV>
<DIV>'these next two lines log events tha happen with npgsql - only required if 
things turn to custard<BR>        
NpgsqlEventLog.Level = 
LogLevel.Debug<BR>        
NpgsqlEventLog.LogName = "NpgsqlTests.Log"</FONT></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>'Connection string - just replace the details with 
yours</FONT></DIV>
<DIV><FONT size=2><FONT face=Arial>        
conn = New NpgsqlConnection("SERVER=10.10.10.9;port=5432;User 
Id=postgres;Password=password;Database=gis2;")<BR>        
Try<BR>            
conn.Open()</FONT></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>'I was trying to keep it tidy so built the SQL 
statement bit by bit</FONT></DIV>
<DIV><FONT size=2><FONT face=Arial>        
SQLStr = "INSERT INTO waypoints(position, 
annotation)"<BR>        SQLStr = SQLStr & 
"VALUES("<BR>        SQLStr = SQLStr & 
"GeometryFromText('POINT(172.668265 -43.538778)', 
4326),"<BR>        SQLStr = SQLStr & 
"'New Waypoint'"<BR>        SQLStr = SQLStr 
& ")"</FONT></FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2><FONT face=Arial>        
command = New NpgsqlCommand(SQLStr, conn)</FONT></FONT></DIV>
<DIV><FONT size=2><FONT 
face=Arial>        rowsaffected = 
command.ExecuteNonQuery()<BR>        Catch ex 
As 
Exception<BR>            
MsgBox(Prompt:=ex.ToString)<BR>        End 
Try</FONT></FONT></DIV>
<DIV><FONT size=2><FONT face=Arial>        
conn.Close()</FONT></FONT></DIV>
<DIV><FONT size=2><FONT face=Arial>End Sub</FONT></FONT></DIV>
<DIV><FONT size=2><FONT face=Arial></FONT></FONT> </DIV>
<DIV><FONT size=2><FONT face=Arial>...npgsql actually has some great examples 
included in it's docs but for us VBer's we need to translate it from C#. I am 
unsure as to why it didn't work before.....I haven't changed the SQL statement 
so must of been my code.</FONT></FONT></DIV>
<DIV><FONT size=2><FONT face=Arial></FONT></FONT> </DIV>
<DIV><FONT size=2><FONT face=Arial>Cheers</FONT></DIV></FONT></BODY></HTML>