Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SQL express + VB exe file help

Author  Topic 

tokingmonkey
Starting Member

1 Post

Posted - 2006-11-04 : 08:51:10
Hey guys,

I am at the moment participating in a project and we have run into a few difficulties which I'm hoping you guys may be able to help with.

In short, we are attempting to construct an online manager game related to cycling. Although the database has been created already in SQL Server Express and some of the website has been made, we also would like to create an executable file (written in Visual Basic) which can be placed on the server and scheduled to execute once a day. The file should read data from the database and perform its defined calculations, before writing back to the database again for further use on the website.

The problem at the moment is that I can't figure out how to make the file recognize the database in such a way that I am able to use read/write statements with SQL directly. I have tried looking numerous places online but all sources show examples of creating web forms and using buttons and such to call functions whereas I simply want one compiled executable.

If you have any advice or recommendations on how I may tackle the problem I would appreciate the help greatly.

Essentially it a question of what is needed (perhaps in terms of code) for me to make the VB file in such a way that I can do SQL queries on it independent of any user interaction. We want the code to handle the database updating on its own each day.

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-11-04 : 08:56:16
quote:
we also would like to create an executable file (written in Visual Basic) which can be placed on the server and scheduled to execute once a day. The file should read data from the database and perform its defined calculations, before writing back to the database again

If all the exe does is "read data from database - perform calculation - update to database", you may not required a exe to do this. Since it is only dealing with database, you can just write a store procedure to perform the required calculation and scheduled it.


KH

Go to Top of Page

snSQL
Master Smack Fu Yak Hacker

1837 Posts

Posted - 2006-11-04 : 16:10:21
You need to create a Windows Service project. That will give you an executable that you can install as a service, it will then run in the background without user interaction even when noone is logged on.
Go to Top of Page

samuelclay
Yak Posting Veteran

71 Posts

Posted - 2006-11-06 : 12:26:59
I agree with khtan.. Doing the calculations in a stored procedure and scheduling it to run each day would be an simple straight forward way to accomplish this...
Go to Top of Page

snSQL
Master Smack Fu Yak Hacker

1837 Posts

Posted - 2006-11-06 : 12:39:36
Just to clarify - I agree 100% with the other replies, that if you can do everything you need in a stored proc and just schedule that, then do it that way. I just assumed that you are doing things in your calculation that you specifically want/need to do in VB, in which case a Windows Service would be the way to go. But if you don't need the VB code then just do it all in the database.
Go to Top of Page
   

- Advertisement -