Click here to Skip to main content
15,889,867 members
Home / Discussions / C#
   

C#

 
GeneralRe: I am working on software in that i need to print certain things....... which is the easy way........ kindly help Pin
amaankhan16-Sep-09 8:17
amaankhan16-Sep-09 8:17 
GeneralRe: I am working on software in that i need to print certain things....... which is the easy way........ kindly help Pin
foxjazzdude16-Sep-09 9:35
foxjazzdude16-Sep-09 9:35 
JokeRe: I am working on software in that i need to print certain things....... which is the easy way........ kindly help Pin
Abhishek Sur16-Sep-09 10:55
professionalAbhishek Sur16-Sep-09 10:55 
GeneralRe: I am working on software in that i need to print certain things....... which is the easy way........ kindly help Pin
rakesh_choudhury16-Sep-09 20:17
rakesh_choudhury16-Sep-09 20:17 
GeneralRe: I am working on software in that i need to print certain things....... which is the easy way........ kindly help Pin
Pete O'Hanlon16-Sep-09 10:32
mvePete O'Hanlon16-Sep-09 10:32 
AnswerRe: I am working on software in that i need to print certain things....... which is the easy way........ kindly help Pin
0x3c016-Sep-09 8:50
0x3c016-Sep-09 8:50 
AnswerRe: I am working on software in that i need to print certain things....... which is the easy way........ kindly help Pin
carlecomm21-Sep-09 19:15
carlecomm21-Sep-09 19:15 
Questionusing console application as service Pin
Rabia_Arif16-Sep-09 6:55
Rabia_Arif16-Sep-09 6:55 
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_id,ser_name from reservation where date = " + ritenow;
objSqlCommand = new SqlCommand(strQueryString, objSqlConnection);

objDataAdapter.SelectCommand = objSqlCommand;
objSqlConnection.Open();
objDataSet.Clear();

objDataAdapter.Fill(objDataSet);
objSqlConnection.Close();
dtTableRecords_out = objDataSet.Tables[0];


if (dtTableRecords_out != null)
{
Console.WriteLine("Service is reserved for today");
}
else
{
Console.WriteLine("No reservation for today");
}
}
finally
{
if (objSqlConnection.State == ConnectionState.Open)
{
objSqlConnection.Close();
}

}
return strQueryString;




}

}
}


I am unable to find any error.When i debug it then nothing happens no black window instead of it an empty form appears.
AnswerRe: using console application as service Pin
Alan N16-Sep-09 7:05
Alan N16-Sep-09 7:05 
AnswerRe: using console application as service Pin
Muhammad Mazhar16-Sep-09 11:24
Muhammad Mazhar16-Sep-09 11:24 
QuestionRunnable and Next Run Date is not coming with job created in Job Activity monitor c# Pin
deepak_dubey16-Sep-09 6:33
deepak_dubey16-Sep-09 6:33 
AnswerRe: Runnable and Next Run Date is not coming with job created in Job Activity monitor c# Pin
deepak_dubey17-Sep-09 20:17
deepak_dubey17-Sep-09 20:17 
QuestionWindows Message Queue Asynchronous Peek Problem Pin
faheemnadeem16-Sep-09 5:24
faheemnadeem16-Sep-09 5:24 
AnswerRe: Windows Message Queue Asynchronous Peek Problem Pin
Matt Meyer16-Sep-09 6:14
Matt Meyer16-Sep-09 6:14 
GeneralRe: Windows Message Queue Asynchronous Peek Problem Pin
faheemnadeem16-Sep-09 17:50
faheemnadeem16-Sep-09 17:50 
GeneralRe: Windows Message Queue Asynchronous Peek Problem Pin
Matt Meyer17-Sep-09 7:01
Matt Meyer17-Sep-09 7:01 
QuestionFile Format Pin
Senseicads16-Sep-09 4:45
Senseicads16-Sep-09 4:45 
AnswerRe: File Format Pin
Eddy Vluggen16-Sep-09 4:49
professionalEddy Vluggen16-Sep-09 4:49 
GeneralRe: File Format Pin
Senseicads16-Sep-09 4:55
Senseicads16-Sep-09 4:55 
GeneralRe: File Format Pin
Eddy Vluggen16-Sep-09 5:20
professionalEddy Vluggen16-Sep-09 5:20 
GeneralRe: File Format Pin
Senseicads16-Sep-09 5:23
Senseicads16-Sep-09 5:23 
GeneralRe: File Format Pin
Eddy Vluggen16-Sep-09 5:28
professionalEddy Vluggen16-Sep-09 5:28 
GeneralRe: File Format Pin
Not Active16-Sep-09 5:31
mentorNot Active16-Sep-09 5:31 
GeneralRe: File Format Pin
Eddy Vluggen16-Sep-09 5:33
professionalEddy Vluggen16-Sep-09 5:33 
GeneralRe: File Format Pin
Not Active16-Sep-09 5:29
mentorNot Active16-Sep-09 5:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.