Jump to content
Xtreme .Net Talk

jdccr

Members
  • Posts

    14
  • Joined

  • Last visited

jdccr's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. I found the solution to my problem... After of the instruction WaitForExit() I had the instruction: cResult = MyProcess.StandardOutput.ReadToEnd I resolved my problem of the following way: MyProcess.Start() cResult = MyProcess.StandardOutput.ReadToEnd MyProcess.WaitForExit() I discovered that my problem was related with the buffer of MyProcess... More details in: http://msdn2.microsoft.com/en-us/library/system.diagnostics.process.standardoutput(VS.71).aspx
  2. I have WinXP Pro SP2 and VS2005 SP1. I'm converting my projects from VS2003 to VS2005 and I receive a lot of warnings in several projects. For example, to one of my projects (for example MyProject.vbproj) I receive the following result in the command prompt: Build succeeded: ... ... (a lot of warnings) ... 95 Warnings(s) 0 Errors Time elapsed 00:00:00.61 But, I'm creating and application in VB2005 that use MSBuild of the following way: MyProcess = New Process MyProcess.StartInfo.FileName = "..\..\msbuild.exe" MyProcess.StartInfo.Arguments = "MyProject.vbproj /t:Rebuild /p:Configuration=Release" MyProcess.StartInfo.CreateNoWindow = True MyProcess.StartInfo.UseShellExecute = False MyProcess.StartInfo.RedirectStandardOutput = True MyProcess.Start() MyProcess.WaitForExit() When I run my application the program stops in the instruction WaitForExit() and not responding, but if I change the properties of MyProject.vbproj and disable all the warnings my application works. Please, help me.
  3. I found the solution!!! In the .NET documentation I found the following: SingleCall: Every incoming message is serviced by a new object instance Singleton: Every incoming message is serviced by the same object instance So, I changed the instruction: RemotingConfiguration.RegisterWellKnownServiceType( _ GetType(RemoteComponent.RemoteClass), _ "RemoteComponent.RemoteClass", _ WellKnownObjectMode.SingleCall) for the instruction: RemotingConfiguration.RegisterWellKnownServiceType( _ GetType(RemoteComponent.RemoteClass), _ "RemoteComponent.RemoteClass", _ WellKnownObjectMode.Singleton) With Singleton the variable oTransaction_m doesn't death and I can to access this variable in the method RunSQL... But, I have a question.... Is there any problem with Singleton? What are the advantages or disadvantages in Singleton??? Thanks for your help!!!
  4. Hi, I am using .NET Remoting for database access. I have three components: 1. A class library 'RemoteComponent.dll': Imports System Imports System.Data.SqlClient Imports System.Runtime.Remoting Imports System.Runtime.Remoting.Channels Imports System.Runtime.Remoting.Channels.Tcp <Serializable()> _ Public Class RemoteClass Inherits MarshalByRefObject Private oConnection_m As SqlConnection Private oTransaction_m As SqlTransaction Private Function ConnectionString() As String Return "user id=sa;password=;Database=Northwind;Server=localhost;Connect Timeout=30" End Function Public Sub BeginTransaction() Dim oCnn As SqlConnection Dim oTrx As SqlTransaction oCnn = New SqlConnection(ConnectionString) If oCnn.State = ConnectionState.Closed Then oCnn.Open() End If oTrx = oCnn.BeginTransaction oConnection_m = oCnn oTransaction_m = oTrx End Sub Public Sub CommitTransaction() oTransaction_m.Commit() oConnection_m.Close() oTransaction_m.Dispose() oTransaction_m = Nothing oConnection_m.Dispose() oConnection_m = Nothing End Sub Public Overloads Function RunSQL( _ ByVal cSQL As String, _ ByVal cTableName As String) As DataSet Dim oCmd As SqlCommand = New SqlCommand Dim oCnn As SqlConnection = Nothing Dim oAdp As SqlDataAdapter = New SqlDataAdapter Dim oDs As DataSet = New DataSet Try oCnn = oTransaction_m.Connection With oCmd .Connection = oCnn .CommandText = cSQL .CommandType = CommandType.Text .Transaction = oTransaction_m End With With oAdp .SelectCommand = oCmd .Fill(oDs, cTableName) End With If IsNothing(oTransaction_m) Then If Not oCnn Is Nothing And oCnn.State <> ConnectionState.Closed Then oCnn.Close() End If End If Return oDs Catch ex As Exception Throw New System.Exception(ex.Message) End Try End Function End Class 2. A console application 'Listener.exe': Imports System imports System.Runtime.Remoting Imports System.Runtime.Remoting.Channels Imports System.Runtime.Remoting.Channels.Tcp Imports System.Runtime.Remoting.Channels.Http Public Class Listener Public Shared Function Main(ByVal args() As String) As Integer Dim channel As TcpChannel = New TcpChannel(8080) ChannelServices.RegisterChannel(channel) RemotingConfiguration.RegisterWellKnownServiceType( _ GetType(RemoteComponent.RemoteClass), _ "RemoteComponent.RemoteClass", _ WellKnownObjectMode.SingleCall) System.Console.WriteLine("Press the enter key to exit...") System.Console.ReadLine() Return 0 End Function End Class 3. A windows application client.exe: Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim chan As TcpChannel = New TcpChannel ChannelServices.RegisterChannel(chan) Dim oRemoteClass As RemoteComponent.RemoteClass = CType(Activator.GetObject( _ GetType(RemoteComponent.RemoteClass), _ "tcp://localhost:8080/RemoteComponent.RemoteClass"), RemoteComponent.RemoteClass) Dim cSQL As String Dim dsData As DataSet Dim nI As Integer cSQL = " select *" cSQL = cSQL & " from customers" oRemoteClass.BeginTransaction() dsData = oRemoteClass.RunSQL(cSQL, "Customers") oRemoteClass.CommitTransaction() ChannelServices.UnregisterChannel(chan) oRemoteClass = Nothing End Sub The application client calls the method BeginTransaction that inicialize the private variable oTransaction_m, but when the application client call the method RunSQL the variable oTransaction_m is nothing... Why the variable oTransaction_m is nothing??? I need test transactions with .NET Remoting!!! Thanks for your help!
  5. I have a doubt Ok, you are right, but I have a doubt: If I don't use .NET Remoting and build the instance of RemoteClass in the following form: Dim oRemoteClass As New RemoteComponent.RemoteClass and If I execute two or more instances of my client application I see one session for each instance of my client application in the database. The question is: Is there any way to obtain this behavior with .NET Remoting???
  6. Hi, I am using .NET Remoting for database connection. I have three components: 1. A class library 'RemoteComponent.dll': Imports System Imports System.Data.SqlClient Imports System.Runtime.Remoting Imports System.Runtime.Remoting.Channels Imports System.Runtime.Remoting.Channels.Tcp Public Class RemoteClass Inherits MarshalByRefObject Public Function ConnectionString() As String Return "user id=sa;password=;Database=Northwind;Server=localhost;Connect Timeout=30" End Function Public Overloads Function RunSQL( _ ByVal cSQL As String, _ ByVal cTableName As String) As DataSet Dim oCmd As SqlCommand = New SqlCommand Dim oCnn As SqlConnection = Nothing Dim oAdp As SqlDataAdapter = New SqlDataAdapter Dim oDs As DataSet = New DataSet Try oCnn = New SqlConnection(ConnectionString) With oCmd .Connection = oCnn .CommandText = cSQL .CommandType = CommandType.Text End With With oAdp .SelectCommand = oCmd .Fill(oDs, cTableName) End With If Not oCnn Is Nothing And oCnn.State <> ConnectionState.Closed Then oCnn.Close() End If Return oDs Catch ex As Exception Throw New System.Exception(ex.Message) End Try End Function End Class 2. A console application 'Listener.exe': Imports System imports System.Runtime.Remoting Imports System.Runtime.Remoting.Channels Imports System.Runtime.Remoting.Channels.Tcp Imports System.Runtime.Remoting.Channels.Http Public Class Listener Public Shared Function Main(ByVal args() As String) As Integer Dim channel As TcpChannel = New TcpChannel(8080) ChannelServices.RegisterChannel(channel) RemotingConfiguration.RegisterWellKnownServiceType( _ GetType(RemoteComponent.RemoteClass), _ "RemoteComponent.RemoteClass", _ WellKnownObjectMode.SingleCall) System.Console.WriteLine("Press the enter key to exit...") System.Console.ReadLine() Return 0 End Function End Class 3. A windows application client.exe: Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim chan As TcpChannel = New TcpChannel ChannelServices.RegisterChannel(chan) Dim oRemoteClass As RemoteComponent.RemoteClass = CType(Activator.GetObject( _ GetType(RemoteComponent.RemoteClass), _ "tcp://omega:8080/RemoteComponent.RemoteClass"), RemoteComponent.RemoteClass) If oRemoteClass Is Nothing Then System.Console.WriteLine("Error: unable to locate server") Else Dim cSQL As String Dim dsData As DataSet cSQL = " select *" cSQL = cSQL & " from customers" dsData = oRemoteClass.RunSQL(cSQL, "Customers") With Me.ComboBox .ValueMember = dsData.Tables("Customers").Columns("CustomerId").ColumnName .DisplayMember = dsData.Tables("Customers").Columns("CompanyName").ColumnName .DataSource = dsData.Tables("Customers").DefaultView End With End If ChannelServices.UnregisterChannel(chan) End Sub I execute two or more instance of my client. In the database I see only one session (commant sp_who in SQL Server) for the NorthWind database. I need one session for each instance of my client application!!! Thanks for your help!!!
  7. I found a temporary solution I found a temporary solution at my problem, I discovered that if I set three breakpoints in the function/sub the program stops in the first breakpoint. If I set one or two breakpoints the program doesn't stop.
  8. I found a temporary solution I tried with Start New Instance but I don't get good result... I found a temporary solution at my problem, I discovered that if I set three breakpoints in the function/sub the program stops in the first breakpoint. If I set one or two breakpoints the program doesn't stop.
  9. No No, the breakpoint markers don't have a question mark.
  10. Messabox.Show works but no the breakpoint I writed the MessagaBox.Show in the entry point and I set the breakpoint. The messagebox display the message correctly, but VB.NET doesn't stop in the breakpoint.
  11. I have the same problem I have the same problem but I has tried all and I don't get good result... I discovered that if I build all my components I get the ability to debug again, but It's frustrating and tedious and I lost a lot time because I have a lot projects. I need a urgent solution at this problem!!!
  12. I'm working in Windows Forms of VB.NET 2003 with n-tiers and I lost constantly the ability to debug my projects. All my components (files .dll) are correctly registered in the GAC. All my projects have the option Debug in the combobox "Solution configuration" and I has tried all. Even I was to delete the directories "obj" and "bin" and build the projects but I don't get a good result. I discovered that if I build all my components I get the ability to debug again, but It's frustrating and tedious and I lost a lot time because I have a lot projects. I don't get messages or errors, simply I set the breakpoint and run the program but the program don't stop in the breakpoint. I need a urgent solution at this problem!!!
  13. I found the solution: In Visual Basic .NET Follow this. From View Menu, Select Other Windows and then Document Outline.
  14. I have the same problem, but any times is sufficient close all projects of .NET and to open only the project with the report...
×
×
  • Create New...