<!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>Thank you very much for the responses - I am making
some excellent progress. I am now connecting to Postgres via .Net ODBC
connection and viewing data from a PostGIS table in PostGres. A corresponding
record is automatically added into the geometry_columns table. Opening QGIS, I
connect to Postgres and the waypoint is available to add. The only problem I
have, is that once added, I can't see the waypoint in the viewing area - it
shows up on the left hand side with a tick next to it......I'm thinking that
somewhere a label needs to added with the data....do I do this in the Postgis
table?</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>My next hurdle is to programmatically insert a
waypoint into the PostGIS database. The following is the arbituary SQL statement
I entered into PostGres which entered the waypoint into the waypoints table
successfully.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV> INSERT INTO waypoints(position,
annotations)<BR>
VALUES(<BR>
GeometryFromText('POINT(172.668265 -43.538778)',
4326),<BR> 'A Random
Waypoint'<BR> )<BR></DIV>
<DIV><FONT face=Arial size=2>......Now, the following is the VB.Net code I use
to open the connection and insert the a waypoint into the PostGIS
database</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Private Sub
InsertWaypoint()<BR> Dim ConnStr As
String<BR> Dim SQLStr As
String<BR> Dim dadapter As
Microsoft.Data.Odbc.OdbcDataAdapter<BR>
Dim OdbcDataReader As
Microsoft.Data.Odbc.OdbcDataAdapter<BR>
Dim connection As
Microsoft.Data.Odbc.OdbcConnection<BR>
Dim cmd As Microsoft.Data.Odbc.OdbcCommand</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> ConnStr
=
"DRIVER={PostgreSQL};SERVER=10.10.10.9;port=5432;DATABASE=gis2;UID=postgres;PWD=password;"<BR>
connection = New Microsoft.Data.Odbc.OdbcConnection(ConnStr)</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> SQLStr =
"INSERT INTO waypoints(position, annotation
"<BR> SQLStr = SQLStr & "VALUES(
"<BR> SQLStr = SQLStr &
"GeometryFromText('POINT(170.507263 -45.895897)',
4326),"<BR> SQLStr = SQLStr &
"'Random Waypoint')"</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> cmd =
New Microsoft.Data.Odbc.OdbcCommand(SQLStr, connection)</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>
Try<BR>
connection.Open()<BR>
dadapter = New
Microsoft.Data.Odbc.OdbcDataAdapter<BR>
dadapter.InsertCommand = New Microsoft.Data.Odbc.OdbcCommand(SQLStr,
connection)<BR>
connection.Close()<BR>
connection = Nothing<BR> Catch ex As
Exception<BR>
MsgBox(ex.ToString)<BR>
Exit Sub<BR> End
Try<BR> End Sub</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>.....This works perfectly....well in so much as it
does not error at any stage but no data appears in the table. I realise this is
not a .Net forum but if anyone can see the problem please let me know. Nothing
appears in the log to indicate a problem.....an error would be easier to deal
with :) The connection part of the above code definitely works as I can use a
Select statement to view records.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Any help would be greatly appreciated</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Cheers</FONT></DIV>
<DIV><FONT face=Arial size=2>Marc</FONT></DIV></BODY></HTML>