Click here to Skip to main content
15,884,177 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Debug time Application run good all private sub and Function work properly, but with out debug not run properly please help me.

What I have tried:

LogFunc(SalesAndInventory.lblUserMain.Text, " Copy Database from D:\Database " & ListView1.Items(k).SubItems(0).Text & " To " & LinkLabel3.Text & " Date: " & lbldt.Text & " Time: " & lbltm.Text & " By : " & sgUserName)


Sub LogFunc(ByVal st1 As String, ByVal st2 As String)
        Try
         
            Dim FilePath As String = "Server=" & My.Settings.srnm & "; Database= " & sgDatabaseName & ";" & " Integrated Security=True;"
            con = New SqlConnection(FilePath)
            con.Open()
            Dim cb As String = "insert into Tbl_Logs(UserID,Date,Operation) VALUES (@d1,@d2,@d3)"
            cmd = New SqlCommand(cb)
            cmd.Connection = con
            cmd.Parameters.AddWithValue("@d1", st1)
            cmd.Parameters.AddWithValue("@d2", System.DateTime.Now)
            cmd.Parameters.AddWithValue("@d3", st2)
            cmd.ExecuteNonQuery()
            con.Close()

        Catch ex As Exception

        End Try

    End Sub
Posted
Updated 8-Apr-20 6:03am
v2
Comments
MadMyche 8-Apr-20 11:37am    
Please use the Improve Question above to tell us what function(s) is/are not working and provide the relevant code.
Jayanta Modak 8-Apr-20 11:40am    
I Improve Question. Please Help me sir
CHill60 8-Apr-20 12:02pm    
What actually happens or does not happen? What does "not properly" mean?
Also - do not use Try-Catch without something in the Catch clause - you are ignoring any error messages at the moment
CHill60 8-Apr-20 12:08pm    
Also - have you actually set up your My.Settings for release mode?
Patrice T 8-Apr-20 12:30pm    
define "not run properly"

1 solution

At a guess - and without access to your systems that's all it can be - the value in My.Settings.srnm or sgDatabaseName is wrong. If you can't use the debugger, then add logging code to write these values to a file, then look at the file once the error has occurred. You can then see exactly what your code is processing and start working out what is failing and why.

Sorry, but we can't do any of that for you!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900