This project has moved and is read-only. For the latest updates, please go here.

Contacting a Sql Server 2005 Express edition

Dec 21, 2006 at 2:35 PM

I am currently trying to connect a Sql Server 2005 Express edition database trough a OleDbPoint method.

I have tried many, many things but i just don't get it working.

The script that i use for contacting the database:

string connStr = "Provider=SQLNCLI;Server=server001\\sqlserver;Database=AIS;Uid=sa;Pwd=Fokko123;"; //Connectionstring
string tablename = "shipinfo"; //Name of table in database
string oid = "mmsi"; //Name of object ID column - MUST be integer!
string xColumn = "latitude"; //Name of X coordinate column - MUST be double!
string yColumn = "longitude"; //Name of Y coordinate column - MUST be double!

SharpMap.Layers.VectorLayer layAddresses = new SharpMap.Layers.VectorLayer("Addresses"); //Create layer
layAddresses.DataSource = new SharpMap.Data.Providers.OleDbPoint(connStr, tablename, oid, xColumn, yColumn); //Set the datasource to the database
ajaxMap.Map.Layers.Add(layAddresses); //Add layer to map

ajaxMap.Map.ZoomToExtents(); //Zoom to extents

But i just can't get it working.
When i execute the script i get:
No error message available, result code: E_FAIL(0x80004005).

When i search in google i get that i use preserved keywords.
But i don´t use any preserved keywords to me.

Does anyone knows how to solve this problem ?
Or is it maybe a bug ?

Thanks in advance,
Dec 21, 2006 at 11:45 PM
Hi. I could not make work the OleDbPoint provider well in SQLExpress. I make a new one provider (I called SqlClientPoint.cs). I copy a SharpMap\Data\Providers\OleDbPoint.cs to a SqlClientPoint.cs, and I only changed a OleDb for SqlClient and works fine to me.
Sorry my bad English.
Regards from Argentina.
Dec 22, 2006 at 9:54 AM
Thank you,

This solved my problem :)