Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. using console application as service

using console application as service

Scheduled Pinned Locked Moved C#
databasehelpcsharpbusinesssales
3 Posts 3 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Rabia_Arif
    wrote on last edited by
    #1

    hello; I have a problem using console application.I mostly use Windows application. I m using C# 2005 and Sql server2005 as part of my project.I am using 3layered architecture i have method in Business class: public static int DataSelectionForAutoGeneratedMsg(string strTableName, out List<string> strContactNos) Because i have to check that if a customer has his reservation booked for next day then he should be reminded for that.For that our service (which i m intended to built using console app) keep checking in the reservation table having columns(cust_id,reservation_date,service_name) . then if the result of the query is correct i.e if it returns datatable then it has to send sms to that customer.Below is the code but i have not included the coding for sending sms here.Instead of that i have just used the Console.Writeline statement so that atlaest this par works also i have not included the coding of internal class ConnectionString Hope the information will be enough for u to understand Code: using System; using System.Collections.Generic; using System.Text; using System.Data; using System.Collections; using System.Data.SqlClient; using HRCF.BL;// adding Business logic using HRCF.DB;//adding database using System.ComponentModel; namespace ConsoleApp_service { public class services { //private CHRCFDB m_objCHRCFDB = null; public services() { //m_objCHRCFDB = new CHRCFDB(); } static void Main(string[] args) { Console.WriteLine("Reading this line"); //dont kno wheather th efollowing line of code is correct or not.It gives no error but no output as well!! string result = Checkingreservation("reservation", out dtTableRecords_out); } public static string CheckingReservation(string strTableName, out DataTable dtTableRecords_out) { string strQueryString = ""; SqlCommand objSqlCommand = null; SqlConnection objSqlConnection = null; DataSet objDataSet = null; SqlDataAdapter objDataAdapter = null; // checking from the current date string ritenow = Convert.ToString(System.DateTime.Now); try { objDataSet = new DataSet(); objDataAdapter = new SqlDataAdapter(); objSqlConnection = new SqlConnection(ConnectionString.GetSQLConnectionString()); strQueryString = "select cust_i

    A M 2 Replies Last reply
    0
    • R Rabia_Arif

      hello; I have a problem using console application.I mostly use Windows application. I m using C# 2005 and Sql server2005 as part of my project.I am using 3layered architecture i have method in Business class: public static int DataSelectionForAutoGeneratedMsg(string strTableName, out List<string> strContactNos) Because i have to check that if a customer has his reservation booked for next day then he should be reminded for that.For that our service (which i m intended to built using console app) keep checking in the reservation table having columns(cust_id,reservation_date,service_name) . then if the result of the query is correct i.e if it returns datatable then it has to send sms to that customer.Below is the code but i have not included the coding for sending sms here.Instead of that i have just used the Console.Writeline statement so that atlaest this par works also i have not included the coding of internal class ConnectionString Hope the information will be enough for u to understand Code: using System; using System.Collections.Generic; using System.Text; using System.Data; using System.Collections; using System.Data.SqlClient; using HRCF.BL;// adding Business logic using HRCF.DB;//adding database using System.ComponentModel; namespace ConsoleApp_service { public class services { //private CHRCFDB m_objCHRCFDB = null; public services() { //m_objCHRCFDB = new CHRCFDB(); } static void Main(string[] args) { Console.WriteLine("Reading this line"); //dont kno wheather th efollowing line of code is correct or not.It gives no error but no output as well!! string result = Checkingreservation("reservation", out dtTableRecords_out); } public static string CheckingReservation(string strTableName, out DataTable dtTableRecords_out) { string strQueryString = ""; SqlCommand objSqlCommand = null; SqlConnection objSqlConnection = null; DataSet objDataSet = null; SqlDataAdapter objDataAdapter = null; // checking from the current date string ritenow = Convert.ToString(System.DateTime.Now); try { objDataSet = new DataSet(); objDataAdapter = new SqlDataAdapter(); objSqlConnection = new SqlConnection(ConnectionString.GetSQLConnectionString()); strQueryString = "select cust_i

      A Offline
      A Offline
      Alan N
      wrote on last edited by
      #2

      Hi, Did you set the output type in project properties to Console Application? It's useful to have Console.Readline() as the final statement in the main method to prevent the window closing before you have read the contents. Alan.

      1 Reply Last reply
      0
      • R Rabia_Arif

        hello; I have a problem using console application.I mostly use Windows application. I m using C# 2005 and Sql server2005 as part of my project.I am using 3layered architecture i have method in Business class: public static int DataSelectionForAutoGeneratedMsg(string strTableName, out List<string> strContactNos) Because i have to check that if a customer has his reservation booked for next day then he should be reminded for that.For that our service (which i m intended to built using console app) keep checking in the reservation table having columns(cust_id,reservation_date,service_name) . then if the result of the query is correct i.e if it returns datatable then it has to send sms to that customer.Below is the code but i have not included the coding for sending sms here.Instead of that i have just used the Console.Writeline statement so that atlaest this par works also i have not included the coding of internal class ConnectionString Hope the information will be enough for u to understand Code: using System; using System.Collections.Generic; using System.Text; using System.Data; using System.Collections; using System.Data.SqlClient; using HRCF.BL;// adding Business logic using HRCF.DB;//adding database using System.ComponentModel; namespace ConsoleApp_service { public class services { //private CHRCFDB m_objCHRCFDB = null; public services() { //m_objCHRCFDB = new CHRCFDB(); } static void Main(string[] args) { Console.WriteLine("Reading this line"); //dont kno wheather th efollowing line of code is correct or not.It gives no error but no output as well!! string result = Checkingreservation("reservation", out dtTableRecords_out); } public static string CheckingReservation(string strTableName, out DataTable dtTableRecords_out) { string strQueryString = ""; SqlCommand objSqlCommand = null; SqlConnection objSqlConnection = null; DataSet objDataSet = null; SqlDataAdapter objDataAdapter = null; // checking from the current date string ritenow = Convert.ToString(System.DateTime.Now); try { objDataSet = new DataSet(); objDataAdapter = new SqlDataAdapter(); objSqlConnection = new SqlConnection(ConnectionString.GetSQLConnectionString()); strQueryString = "select cust_i

        M Offline
        M Offline
        Muhammad Mazhar
        wrote on last edited by
        #3

        First of all make sure that you have created project by selecting proper project type and secondly put Console.Read(); statement at very end of your main method to put a pasue in execution.

        Share your experience with others Check my Blog...

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups