|
Thanks for all your help! The code access security change worked!
Lost in the vast sea of .NET
|
|
|
|
|
One problem may be that the server process which tries to execute the program is running on different credentials (for example under local system) than what you used when you tested starting the program.
Also catch all exceptions and write them to a log or whereever it's easy for you to check if the call failed.
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
I agree with catching all exceptions and the service is processing the code. Nothing fires however. I tried mapping the network directory on the server and for some reason when the service runs under the same network credentials as the login that I created the mapping it didn't recognize the path. It bailed and was caught by the try/catch logic.
Like I said the credentials for the service firing off the executable is using a network credential with administrative privileges.
The shell logic which was the first reply seems to work but I'm not sure why the process.start logic doesn't.
Any other suggestions are appreciated.
Lost in the vast sea of .NET
|
|
|
|
|
I would try this. Create a new generic win app to test with. Use the following overloaded version of the process.start method.
Public Shared Function Process.Start ( _
fileName As String, _
userName As String, _
password As SecureString, _
domain As String _
) As Process
Get it to work from the generic app and then change your service as needed. Services can be hard to debug. Ensure when the service is installed that the credentials on the service are correct as well (right click the service in the control panel and change as needed).
If push came to shove, you could call something like CreateProcessWithLogon or do the generic shell:
Declare Function CreateProcessWithLogon Lib "advapi32" Alias "CreateProcessWithLogonW"
If someone wants to ding me on the score fine, just let me know why. Thanks.
Any suggestions, ideas, or 'constructive criticism' are always welcome.
modified on Thursday, October 23, 2008 2:29 PM
|
|
|
|
|
KreativeKai wrote: I tried mapping the network directory on the server and for some reason when the service runs under the same network credentials as the login that I created the mapping it didn't recognize the path.
This is because any mapping you make is specific to your logon session. Any other session using the same credentials will not see any drive you map. That's why I asked if the drive is mapped from a login script. Services run under their own login session and under an entirely different desktop. They (normally) have no idea, nor should they even care, if a user is logged on or not.
|
|
|
|
|
Instead of directly starting the exe, try to use ProcessInfo class. Especially following properties may be helpful:
- Domain
- ErrorDialog
- FileName
- LoadUserProfile
- RedirectStandardError/Output
- Username/Password
- WorkingDirectory
Hope this helps,
Mika
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
Thanks for your help! The problem turned out to be linked to security. Thanks again!
Lost in the vast sea of .NET
|
|
|
|
|
No problem
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
Is it possible to do a dataview.Sort with part of a column? I have a datatable with 4 columns. I need to sort off the first column, but only off the first 4 characters, like this:
ORDER BY LEFT(ScheduleID,4) DESC
The above order by is valid in SQL, but doesn't appear to work in the dataview.sort using "LEFT(ScheduleID,4) DESC". Of course "ScheduleID DESC" works, but I don't get the desired results.
Any suggestions, ideas, or 'constructive criticism' are always welcome.
|
|
|
|
|
No, it's not. You'd have to split the values in that column into another column with just the data that's valid for the sort, then sort on this column.
But, as you've found out, it's easier to do on the database side, and it'll have far better performance too.
|
|
|
|
|
Unfortunately, I'm building the datagridview rows from reading in a text file.
Your idea about adding a hidden sort column is brilliant!
Thanks Dave.
Any suggestions, ideas, or 'constructive criticism' are always welcome.
|
|
|
|
|
I am having trouble finding documentation on how to, using Vb.net to read a png file into a string and convert to Hex.
Dow anyone have any code examples for me? Thank you
|
|
|
|
|
What do you mean by "reading a png file into a string and convert to Hex"??
Any file is just a stream of byte values, 0x00 thru 0xFF. Converting those to Hex is as easy as using String.Format("{0:X2}", value) to return a single value as a Hex string. What you do with those strings is up to you.
|
|
|
|
|
I am reading the png like this. (I don't know if this is the best way.
Dim ascii() As Byte = File.ReadAllBytes("C:\3604.png")
I want to put This into a string.
dim str as string = String.Format("{0:X2}", ascii) Does not work.
Is there an easy way besides looping through each byte and copying it to string?
|
|
|
|
|
Cory Kimble wrote: dim str as string = String.Format("{0:X2}", ascii) Does not work.
Sure it does, when you convert each and every byte in the array, individually. You can't send an array to Format and expect it to iterate over the array for you.
Cory Kimble wrote: Is there an easy way besides looping through each byte and copying it to string?
Nope. That's the only method you have.
|
|
|
|
|
Hi,
I wotre years ago in vb6 a database for music. I want to convert the whole program into VB.net 2008.
The original program was with cddb from gracenote.
The question now is is there support for .net by gracenote or is there something beter/easyer but with the same functions?
Like seeing what cds is in the drive, editing mp3 tags
If posible also support for DVD(music/films/series)
Jan
some examples from the new system are welcome
|
|
|
|
|
There's a GPL service called FreeDB[^] now.
|
|
|
|
|
What must I download?
I think the server software but thats only in C
Jan
|
|
|
|
|
Hi,
I am trying to add a 3rd party dll(C++) to my application which is created on vb.net. when i tried to add that dll as reference i got a error as "A reference to <file location=""> could not be added. Please make sure that the file is accessible, and that it is a valid assembly or COM component."
When i checked this in online, it seems to be unmanged code which is not accepted by .net and also they said P/Invoke command something like that.
But actually i dont know how to register a dll or use Pinvoke method or how i add a unmanged dll into my application, Can anyone help in this.
Thanks,
Nanda
|
|
|
|
|
Register a dll using regsvr32.exe. Do you know the functions exported by the dll?
|
|
|
|
|
Thanks JZ, But again.
how to do that with regsrv32.exe, for example my dll name is nanda.dll, where i have to do this and how and what was the output
Thanks,
Nanda
|
|
|
|
|
REGSVR32 filename.dll
But, if the .DLL is not COM-based, this wont work and you'll be forced to use P/Invoke to call the functions in the .DLL. You will not be able to set a reference to it and have VS import the functions for you.
|
|
|
|
|
Thanks Dave,
I tried but It throws a message box
<dll> was loaded, but the DllRegisterServer entry point was not found.
This file can not be registered.
I hope this dll is not com based
Can you please help me how to use P/Invoke with an example.
Thanks,
Nanda
|
|
|
|
|
You got that error because the .DLL is not COM-based. You'll have to use P/Invoke to get at the functions in that library. I hope you have the documentation on it.
http://www.pinvoke.net[^] has tons of examples.
|
|
|
|
|
Hi
I created store produce to insert selected values from checkboxlist into sql database and it gives me this error "Procedure or function SaveAdmin has too many arguments specified."
here is my store procedure
ALTER PROCEDURE [dbo].[SaveAdmin]
-- Add the parameters for the stored procedure here
@Perno int,
@Client_id int,
@Region_id int,
@Service_id int
AS
INSERT INTO Admin(Perno, Client_id, Region_id, Service_id)
VALUES(@Perno, @Client_id, @Region_id, @Service_id)
and here is my vb.net code
cmdStandby.CommandText = "SaveAdmin"
cmdStandby.CommandType = CommandType.StoredProcedure
cmdStandby.Connection = sqlstandby
cmdStandby.Parameters.AddWithValue("@Perno", lblEmpNo.Text)
cmdStandby.Parameters.AddWithValue("@Client_id", ddlClient1.SelectedValue)
For Each li In ChkRegion.Items
If li.Selected = True Then
cmdStandby.Parameters.AddWithValue("@Region_id", li.Value)
End If
Next
For Each li In ChkService.Items
If li.Selected = True Then
cmdStandby.Parameters.AddWithValue("@Service_id", li.Value)
End If
Next
cmdStandby.ExecuteNonQuery()
thanx in advance
Mamphekgo
|
|
|
|