Solved

How to change to .exe file?

Posted on 2004-04-11
11
384 Views
Last Modified: 2010-04-17
Hi expert,

Currently I'm using Microsoft Visual Studio.Net to program an application.
Now I need to run the application in scheduler task.
May I know to change the program so that it can run as .exe file?
Thanx.

Regards,
Joanne84
0
Comment
Question by:joanne84
11 Comments
 
LVL 12

Expert Comment

by:guidway
ID: 10803296
when you compile your project it should create the executable automatically. You may need to search for the name of it on the computer. If you have errors during the compile it will not create the executable until they are all fixed.
0
 

Author Comment

by:joanne84
ID: 10803969
Hi,

The compilation is error free.
But how can I find the .exe file?

Is it namely filename.exe?

Please advise.
Thanx.

Regards,
joanne84
0
 
LVL 8

Expert Comment

by:harris_c
ID: 10804258
Hi Joanne84,

The name is usually the project name.  It is in *bold* letters in the solution explorer window.

You can find the executable in the "bin" directory in your project folder.



hec",)
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 22

Expert Comment

by:cookre
ID: 10805603
<ProjectDirectory> \ bin \ 'debug' or 'release'
0
 

Author Comment

by:joanne84
ID: 10809766
Hi,

The schedule task still show me the status: Could Not Start...

For ur information, the scheduler that I want to run is scheduler.aspx, which is inside a project namely, Seminar. I can only found Seminar.pdb and Seminar.dll in the bin folder.

I tried to run both file, also cannot. Do I need to create a new project name Scheduler instead?
Otherwise, please advise.

Thanx.

Regards,
joanne84
0
 
LVL 1

Accepted Solution

by:
dapcom earned 50 total points
ID: 10814537
It seems your project is a Web Application, so there's no exe file created.

It might have been a better idea to create a Windows application?

What do you expect from the scheduled application? Is it supposed to open in a browser? Is the aspx supposed to run on your PC or on a server?

If a Web application is really what you need (or can't change it). You need to use the URL of the aspx in the web server.
If on your own PC, it must be something like : http://localhost/Seminar/scheduler.aspx, unless you configured your web server otherwise.
If on another web server, it depends where it was installed.

Did I add some light?

Dan


0
 

Author Comment

by:joanne84
ID: 10819538
I get what you mean.
So, now I've created a window application.
And I copied the coding in .aspx to the window application.

Where  should I put the db connection as in web application, we put it in web.config?

It shows a break point at       
dr = myCommand.ExecuteReader();

An unhandled exception of type 'System.InvalidOperationException' occurred in system.data.dll
Additional information: The ConnectionString property has not been initialized.

I still fresh to .net, so sorry for my poor understanding...

Regards,
joanne84

0
 
LVL 1

Expert Comment

by:dapcom
ID: 10832286
To start, just put it in your code:
    Dim myConnectionString as String = "Your connection string"
    Dim myConnection As New SqlConnection(myConnectionString)
    Dim myCommand As New SqlCommand(mySelectQuery, myConnection)
    dr = myCommand.ExecuteReader();

when it works, create an application.config file in the same folder as the exe, same name, but extension .config:
<configuration>
   <appSettings>
      <add key="ConnectionString" value="type your connection string here" />
   </appSettings>
</configuration>

Then use the ConfigurationSettings class to replace the hardcoded connection string.

myConnectionString=ConfigurationSettings.AppSettings("ConnectionString")

(you can have a look at : http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vboriintroductiontoapplicationsettingstorage.asp)

Dan
0
 

Author Comment

by:joanne84
ID: 10839553
Hi Dan,

For your info, I'm using C#...
I've created a Form1.config to put the database configuration, but the previous error still occur...

To have clear idea of my project, below are some of the code:

[STAThread]
static void Main()
{      Application.Run(new Form1());           }

private void button1_Click(object sender, System.EventArgs e)
{      this.Close ();      }
public Form1()
{      InitializeComponent();
      Run();
}

In the Run(), I retrieve information from a userclass, which return datareader, dr.

It shows a break point at      
dr = myCommand.ExecuteReader();   //Occur in the user class file

Do you have any solution?
Thanx in advance.

joanne84
0
 
LVL 1

Expert Comment

by:dapcom
ID: 10840936
Hi joanne84,

Thanks for the points :)

Your file should have the name of the application, not the form. In your case I think it is Seminar.config and must be in the same directory as your exe (in bin).

Did you translate the code i gave you in C# or do you need help for that?
Do you have the same error message?
It seems the connection string is not set. You must retrieve it with the

ConfigurationSettings.AppSettings("ConnectionString")

The easiest would be if you send the code of the Run() procedure (or the relevent part of it, around the error), so I can have a look at it.



Dan

0
 

Author Comment

by:joanne84
ID: 10847127
Hi Dan,

Thanx for your help.
I already solved the problem.

Actually, I just need to create a console application, then use a web client to call the URL of the file that I want it to run, for this case is Scheduler.aspx.

Then in the scheduler task, I call the console application's application file, then can already.

Thanx:-)

Regards,
joanne84

0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A short article about a problem I had getting the GPS LocationListener working.
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question