Click here to Skip to main content
15,915,324 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Greetings to you all, please i am in need of help with the following issue:

Using Vb.net 2012, I created a sql script with the intention to read and execute it from my vb.net application. i stored the file in the application startuppath and referenced it with the following code as stated bellow but i kept getting the error:
Could not find file 'C:\Users\User\Documents\Visual Studio 2012\Projects\E_Service_Mgr_V2\E_Service_Mgr_V2\bin\Debug\E_ITM_DB_OBJ'.


The file name is "E_ITM_DB_OBJ".
Any help with this will be appreciated.

Thanks in anticipation.
Frank

What I have tried:

I've tried changing the path and using the full path name, but got the same result.
Please help.

Thanks.
Using sr As StreamReader = New StreamReader(Application.StartupPath & "\E_ITM_DB_OBJ")
            st = sr.ReadToEnd()
            Dim server As New Server(New ServerConnection(con))
            server.ConnectionContext.ExecuteNonQuery(st)
        End Using
Posted
Updated 23-Jan-18 20:20pm
v2
Comments
F-ES Sitecore 22-Jan-18 11:43am    
The file obviously doesn't exist in that location. We can't access your hard drive so I'm not sure exactly what help you are looking for. Make sure the file is where you are trying to load it from.

Copy that path to the clipboard, without the final part - up to the last '\' character:
C:\Users\User\Documents\Visual Studio 2012\Projects\E_Service_Mgr_V2\E_Service_Mgr_V2\bin\Debug
Now hold the Windows Key and press E - this will open Windows explorer.
Click on the address bar where it says "This PC" and paste the path. Press ENTER
If it gives you an error, the path to your EXE file is wrong, and you need to look at where you got it from.
If not, it will open the folder - start looking for files called E_ITM_DB_OBJ.
If you find any, look closely and check for any extension - a file without one is unusual as it's the extension Windows uses to determine what to do with a file. The most likely thing is that it's there, but that id has an extension such as ".SQL", ".DB", or even ".TXT". If it does, then you need that extension in your filename when you try to open it or Windows will not find it.
 
Share this answer
 
Comments
Richard Deeming 23-Jan-18 12:23pm    
Might also be worth pointing out that Windows still defaults to hiding the file extensions.
Thanks so much to you all who commented on my question. I was able to go over it using the following procedures:

1.Show all files from the solution explorer
2.Located the bin>deburg folder and right clicked on it
3.Selected add existing item from the context menu
4. Added the file and that was it.

Thanks to you all. How ever, i encountered another issue after this. I was getting the following error while the file is being read:
"
Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.
"

I have tried locating the SGEn.EXE.CONFIG in the following directory:
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin
and added the following:
<startup useLegacyV2RuntimeActivationPolicy="true">

                <supportedRuntime version="v4.0" />

    </startup>    
to the config section but i was denied access to save or overwrite the file.


I am Still in dear need of help with this.

Thanks in anticipation.
 
Share this answer
 
Comments
Richard Deeming 23-Jan-18 14:04pm    
You need to change the config file for your application, not some random config file from the Windows SDK.
Greetings to you all and thank you all for your assistance. I have been able to overcome the issue by adding the following settings to the startup tag of the application's config file:
<startup useLegacyV2RuntimeActivationPolicy="true">


Again thanks for the help.
 
Share this answer
 

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



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