System error 203 The System could not find environment option

S

sfunds sfunds

I have implemented all the function exposed my the interface.

However when I start Wealth-lab and when it calls the WLEod Interface

it gives error

System error 203
The System could not find environment option
that was entered


How do i ensure the Wealth-lab finds environment option

or
what is the procedure for implementing interfaces exposed by other
application
Thanks
 
S

sfunds sfunds

Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.ComponentModel
Imports WealthLab




Public Class SQLConnector
Implements WealthLab.IWealthLabEOD3



Public Function CreateDataSource() As String Implements
IWealthLabEOD3.CreateDataSource
CreateDataSource =
"server=(local);database=ShareMarket;UID=sa;password=sa"
End Function

Public Sub FillSymbols(ByVal DSString As String, ByVal Symbols As
IWealthLabStrings3) Implements IWealthLabEOD3.FillSymbols
Dim myReader As SqlDataReader
Dim mySqlConnection As SqlConnection
Dim mySqlCommand As SqlCommand



mySqlConnection = New
SqlConnection("server=(local);database=ShareMarket;UID=sa;password=sa")
mySqlCommand = New SqlCommand("select CompanyName from
ScriptDetails", mySqlConnection)

Try
mySqlConnection.Open()
myReader = mySqlCommand.ExecuteReader()




Do While (myReader.Read())
Symbols.Add(myReader("nse_symbol").ToString())
Loop
Catch e As Exception
Console.WriteLine(e.ToString())
Finally
If Not (myReader Is Nothing) Then
myReader.Close()
End If

If (mySqlConnection.State = ConnectionState.Open) Then
mySqlConnection.Close()
End If
End Try

End Sub

Public Sub LoadSymbol(ByVal DSString As String, ByVal Symbol As
String, ByVal Bars As IWealthLabBars3, ByVal StartDate As Date, ByVal
EndDate As Date, ByVal MaxBars As Integer) Implements
IWealthLabEOD3.LoadSymbol
Dim myReader As SqlDataReader
Dim mySqlConnection As SqlConnection
Dim mySqlCommand As SqlCommand
Dim myDate As Date
Dim open As Double
Dim high As Double
Dim low As Double
Dim close As Double
Dim Volume As Integer





mySqlConnection = New
SqlConnection("server=(local);database=ShareMarket;UID=sa;password=sa")
mySqlCommand = New SqlCommand("select
[timestamp],[open],high,low,[close],tottrdqty from" + Symbol,
mySqlConnection)

Try
mySqlConnection.Open()
myReader = mySqlCommand.ExecuteReader()
Do While (myReader.Read())
myDate = myReader.GetDateTime(0)
open = myReader.GetDouble(1)
high = myReader.GetDouble(2)
low = myReader.GetDouble(3)
close = myReader.GetDouble(4)
Volume = myReader.GetInt32(5)
Bars.Add(myDate, open, high, low, close, Volume)
Loop
Catch e As Exception
Console.WriteLine(e.ToString())
Finally
If Not (myReader Is Nothing) Then
myReader.Close()
End If

If (mySqlConnection.State = ConnectionState.Open) Then
mySqlConnection.Close()
End If
End Try
End Sub

Public Function GetSecurityName(ByVal Symbol As String) As String
Implements IWealthLabEOD3.GetSecurityName
Dim myReader As SqlDataReader
Dim mySqlConnection As SqlConnection
Dim mySqlCommand As SqlCommand



mySqlConnection = New
SqlConnection("server=(local);database=ShareMarket;UID=sa;password=sa")
mySqlCommand = New SqlCommand("select nse_symbol from
ScriptDetails where nse_symbol = " + Symbol, mySqlConnection)

Try
mySqlConnection.Open()
myReader = mySqlCommand.ExecuteReader()
myReader.Read()
GetSecurityName = myReader("nse_symbol").ToString()

Catch e As Exception
Console.WriteLine(e.ToString())
Finally
If Not (myReader Is Nothing) Then
myReader.Close()
End If

If (mySqlConnection.State = ConnectionState.Open) Then
mySqlConnection.Close()
End If
End Try
Return GetSecurityName
End Function



End Class

The above code works fine with my Test class
However When i use it in wealth-lab it gives me the above error
 
C

CT

Hmm, from browsing your code I can't see anything wrong. When do you get
this error, at compile time or run-time? Is it any particular line that
throws the exception? What is the WealthLab namespace, is it .NET or is it a
referenced COM component?

--
Carsten Thomsen
Enterprise Development with VS .NET, UML, and MSF
http://www.apress.com/book/bookDisplay.html?bID=105
sfunds sfunds said:
Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.ComponentModel
Imports WealthLab




Public Class SQLConnector
Implements WealthLab.IWealthLabEOD3



Public Function CreateDataSource() As String Implements
IWealthLabEOD3.CreateDataSource
CreateDataSource =
"server=(local);database=ShareMarket;UID=sa;password=sa"
End Function

Public Sub FillSymbols(ByVal DSString As String, ByVal Symbols As
IWealthLabStrings3) Implements IWealthLabEOD3.FillSymbols
Dim myReader As SqlDataReader
Dim mySqlConnection As SqlConnection
Dim mySqlCommand As SqlCommand



mySqlConnection = New
SqlConnection("server=(local);database=ShareMarket;UID=sa;password=sa")
mySqlCommand = New SqlCommand("select CompanyName from
ScriptDetails", mySqlConnection)

Try
mySqlConnection.Open()
myReader = mySqlCommand.ExecuteReader()




Do While (myReader.Read())
Symbols.Add(myReader("nse_symbol").ToString())
Loop
Catch e As Exception
Console.WriteLine(e.ToString())
Finally
If Not (myReader Is Nothing) Then
myReader.Close()
End If

If (mySqlConnection.State = ConnectionState.Open) Then
mySqlConnection.Close()
End If
End Try

End Sub

Public Sub LoadSymbol(ByVal DSString As String, ByVal Symbol As
String, ByVal Bars As IWealthLabBars3, ByVal StartDate As Date, ByVal
EndDate As Date, ByVal MaxBars As Integer) Implements
IWealthLabEOD3.LoadSymbol
Dim myReader As SqlDataReader
Dim mySqlConnection As SqlConnection
Dim mySqlCommand As SqlCommand
Dim myDate As Date
Dim open As Double
Dim high As Double
Dim low As Double
Dim close As Double
Dim Volume As Integer





mySqlConnection = New
SqlConnection("server=(local);database=ShareMarket;UID=sa;password=sa")
mySqlCommand = New SqlCommand("select
[timestamp],[open],high,low,[close],tottrdqty from" + Symbol,
mySqlConnection)

Try
mySqlConnection.Open()
myReader = mySqlCommand.ExecuteReader()
Do While (myReader.Read())
myDate = myReader.GetDateTime(0)
open = myReader.GetDouble(1)
high = myReader.GetDouble(2)
low = myReader.GetDouble(3)
close = myReader.GetDouble(4)
Volume = myReader.GetInt32(5)
Bars.Add(myDate, open, high, low, close, Volume)
Loop
Catch e As Exception
Console.WriteLine(e.ToString())
Finally
If Not (myReader Is Nothing) Then
myReader.Close()
End If

If (mySqlConnection.State = ConnectionState.Open) Then
mySqlConnection.Close()
End If
End Try
End Sub

Public Function GetSecurityName(ByVal Symbol As String) As String
Implements IWealthLabEOD3.GetSecurityName
Dim myReader As SqlDataReader
Dim mySqlConnection As SqlConnection
Dim mySqlCommand As SqlCommand



mySqlConnection = New
SqlConnection("server=(local);database=ShareMarket;UID=sa;password=sa")
mySqlCommand = New SqlCommand("select nse_symbol from
ScriptDetails where nse_symbol = " + Symbol, mySqlConnection)

Try
mySqlConnection.Open()
myReader = mySqlCommand.ExecuteReader()
myReader.Read()
GetSecurityName = myReader("nse_symbol").ToString()

Catch e As Exception
Console.WriteLine(e.ToString())
Finally
If Not (myReader Is Nothing) Then
myReader.Close()
End If

If (mySqlConnection.State = ConnectionState.Open) Then
mySqlConnection.Close()
End If
End Try
Return GetSecurityName
End Function



End Class

The above code works fine with my Test class
However When i use it in wealth-lab it gives me the above error
 
C

CT

Is this COM conponent created in VB6 or...? What about the error, does it
occur at run-time or compile-time and does it happen all the time?
 
S

Sridhar Raman

Hi,
First of all let me thank you For your help.

Wealth-lab is share trading application.
You can write your adapters to get data from different sources.

The welat-lab(probably a Delphi application)
exposes WEalthLab class library (Com based)
In order to wealth-lab read data from my SQL SERVER
I have to implement the four methods I have written

I just compiled the above code and what ever dll and files generated in
bin directory (Interop File) I copied to wealt-lab directory.

I get the above error

Thanks

Sridhar Raman
 
C

CT

I don't think this is an error in your code. I bas ethis on the fact that it
works with a test class, but not when you use it with your wealt-lab
application. Now, what does the wealt-lab appliation expect, i.e. I assume
it realies on you providing a COM component, right? If so, have you created
the wrapper and registered your assembly as a COM component on the system on
which wealt-lab runs?
 
S

Sridhar Raman

Hi

Previously I did not do regasm to register the assembly
I have done that now I dont get system error 203
Do i need to do anything more to create wrapper and register assembly
Sorry to bother you again.

I am posting the code below.
I get No such interface supported after
the messagebox(fillsymbol add) and also after load msg box

It does not come after create data source.
It fills symbol and the ACC appears in Fill Symbol

Microsoft support does not say anything abt No such interface supported
(only for visual interdev it says to reinstall the dll)
can you figure out what can be the error

Sridhar Raman
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,733
Messages
2,569,440
Members
44,830
Latest member
ZADIva7383

Latest Threads

Top