Search Results

Search found 2 results on 1 pages for 'mazrabul'.

Page 1/1 | 1 

  • vb.net sqlite how to loop through selected records and pass each record as a parameter to another fu

    - by mazrabul
    Hi, I have a sqlite table with following fields: Langauge level hours German 2 50 French 3 40 English 1 60 German 1 10 English 2 50 English 3 60 German 1 20 French 2 40 I want to loop through the records based on language and other conditions and then pass the current selected record to a different function. So I have the following mixture of actual code and psudo code. I need help with converting the psudo code to actual code, please. I am finding it difficult to do so. Here is what I have: Private sub mainp() Dim oslcConnection As New SQLite.SQLiteConnection Dim oslcCommand As SQLite.SQLiteCommand Dim langs() As String = {"German", "French", "English"} Dim i as Integer = 0 oslcConnection.ConnectionString = "Data Source=" & My.Settings.dbFullPath & ";" oslcConnection.Open() oslcCommand = oslcConnection.CreateCommand Do While i <= langs.count If langs(i) = "German" Then oslcCommand.CommandText = "SELECT * FROM table WHERE language = '" & langs(i) & "';" For each record selected 'psudo code If level = 1 Then 'psudo code update level to 2 'psudo code minorp(currentRecord) 'psudo code: calling minorp function and passing the whole record as a parameter End If 'psudo code If level = 2 Then 'psudo code update level to 3 'psudo code minorp(currentRecord) 'psudo code: calling minorp function and passing the whole record as a parameter End If 'psudo code Next 'psudo code End If If langs(i) = "French" Then oslcCommand.CommandText = "SELECT * FROM table WHERE language = '" & langs(i) & "';" For each record selected 'psudo code If level = 1 Then 'psudo code update level to 2 'psudo code minorp(currentRecord) 'psudo code: calling minorp function and passing the whole record as a parameter End If 'psudo code If level = 2 Then 'psudo code update level to 3 'psudo code minorp(currentRecord) 'psudo code: calling minorp function and passing the whole record as a parameter End If 'psudo code Next 'psudo code End If Loop End Sub Many thanks for your help.

    Read the article

  • vb.net how to start a folder monitor service at runtime and pass on the folder path to monitor?

    - by mazrabul
    hi, I have the following windows service file: Imports System.ServiceProcess Imports System.IO Public Class fswService Dim fsw As FileSystemWatcher Dim lf As StreamWriter Protected Overrides Sub OnStart(ByVal args As String()) ' Add code here to start your service. This method should set things ' in motion so your service can do its work. lf = New StreamWriter(Application.StartupPath & "\fsw_lg.log") fsw = New FileSystemWatcher() fsw.Path = args(0) fsw.IncludeSubdirectories = True fsw.Filter = ".txt" fsw.EnableRaisingEvents = True AddHandler fsw.Created, New FileSystemEventHandler(AddressOf file_created) AddHandler fsw.Changed, New FileSystemEventHandler(AddressOf file_changed) AddHandler fsw.Deleted, New FileSystemEventHandler(AddressOf file_deleted) End Sub Public Sub file_created(ByVal obj As Object, ByVal e As FileSystemEventArgs) lf.WriteLine(Now.ToShortDateString & "-" & Now.ToShortTimeString & "-" & e.FullPath & "-created") End Sub Public Sub file_changed(ByVal obj As Object, ByVal e As FileSystemEventArgs) lf.WriteLine(Now.ToShortDateString & "-" & Now.ToShortTimeString & "-" & e.FullPath & "-changed") End Sub Public Sub file_deleted(ByVal obj As Object, ByVal e As FileSystemEventArgs) lf.WriteLine(Now.ToShortDateString & "-" & Now.ToShortTimeString & "-" & e.FullPath & "-deleted") End Sub Protected Overrides Sub OnStop() lf.Close() End Sub End Class i have the ServiceName set to fswService (same as class name). When I added an installer I also set the ServiceName for the ServiceInstaller1 as fswService. I want to start this service at runtime based on the user setting the path of the folder to be watched. To achieve this I have the following: Dim fsw_controller As New ServiceProcess.ServiceController fsw_controller.Start(fswService) 2 problems: first, intellisense error saying: 'fswService' is a type and cannot be used as an expression. second, I can not figure out a way to pass on to the service the path of the folder to watch (which is stored at My.Settings.userPath). I really thought this is how you start a service. Am I missing something? Your help is, as always, appreciated. Thanks

    Read the article

1