Click here to Skip to main content
15,887,961 members
Home / Discussions / C#
   

C#

 
QuestionTransparency on moving controls? Pin
Sindicoro19-Sep-09 20:09
Sindicoro19-Sep-09 20:09 
AnswerRe: Transparency on moving controls? Pin
Henry Minute19-Sep-09 20:57
Henry Minute19-Sep-09 20:57 
QuestionHelp with passing an array to a method Pin
Ceceily19-Sep-09 18:01
Ceceily19-Sep-09 18:01 
AnswerRe: Help with passing an array to a method Pin
Luc Pattyn19-Sep-09 18:13
sitebuilderLuc Pattyn19-Sep-09 18:13 
GeneralRe: Help with passing an array to a method Pin
Ceceily19-Sep-09 18:32
Ceceily19-Sep-09 18:32 
GeneralRe: Help with passing an array to a method Pin
Ceceily19-Sep-09 19:18
Ceceily19-Sep-09 19:18 
Questionretreiving values from datatable Pin
Rabia_Arif19-Sep-09 17:53
Rabia_Arif19-Sep-09 17:53 
AnswerRe: retreiving values from datatable Pin
Henry Minute19-Sep-09 21:15
Henry Minute19-Sep-09 21:15 
I think that you have made an error in your if condition. How can strQueryString be null? Just a few lines above you set it to "select * from view_reservation where date = " + date_nextDay;, and you never reset it!

From a very quick look at your code I suspect that what you need is something like:
if (dtTableRecords_out.Rows.Count > 0)
{
    Console.WriteLine("Service is reserved for tommorow");
}
else
{
    Console.WriteLine("no reervation");
}


Two other things that might make your code better/more secure. Please research the using construct, this will enable you to do things like:
using (objSqlConnection = new SqlConnection(ConnectionString.GetSQLConnectionString()))
{
    strQueryString = "select * from view_reservation where  date = " + date_nextDay;
    objSqlCommand = new SqlCommand(strQueryString, objSqlConnection);

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

    objDataAdapter.Fill(objDataSet);
    objSqlConnection.Close();    //<=============== delete this line, no longer required
}


Using using ensures that objSqlConnection gets closed and disposed, guaranteed, regardless of exceptions or any other problem short of a power-cut.

Also research using parameterized queries Building SQL statements the way you are currently doing, is prone to all sorts of malicious exploits.

Good Luck! Smile | :)

Henry Minute

Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”

GeneralRe: retreiving values from datatable Pin
Rabia_Arif21-Sep-09 21:09
Rabia_Arif21-Sep-09 21:09 
AnswerRe: retreiving values from datatable Pin
Patrik.karlin20-Sep-09 0:42
Patrik.karlin20-Sep-09 0:42 
Questionhow to printpriview the datagridview data in c# Pin
Ramesh Reddy1111119-Sep-09 16:57
Ramesh Reddy1111119-Sep-09 16:57 
AnswerRe: how to printpriview the datagridview data in c# Pin
Christian Graus19-Sep-09 17:04
protectorChristian Graus19-Sep-09 17:04 
QuestionC# Word Interop - Insert Image into a specific cell in a table located in the document header Pin
jasonandrew19-Sep-09 14:08
jasonandrew19-Sep-09 14:08 
AnswerRe: C# Word Interop - Insert Image into a specific cell in a table located in the document header Pin
73amit17-Sep-10 0:45
73amit17-Sep-10 0:45 
AnswerRe: C# Word Interop - Insert Image into a specific cell in a table located in the document header Pin
AshokNaik10-Jul-11 21:45
AshokNaik10-Jul-11 21:45 
QuestionRe: C# Word Interop - Insert Image into a specific cell in a table located in the document header Pin
Member 110410579-Mar-15 0:50
Member 110410579-Mar-15 0:50 
QuestionImage position in other image c# ? [modified] Pin
sodevrom19-Sep-09 12:29
sodevrom19-Sep-09 12:29 
AnswerRe: Image position in other image c# ? Pin
Dave Kreskowiak19-Sep-09 14:01
mveDave Kreskowiak19-Sep-09 14:01 
GeneralRe: Image position in other image c# ? Pin
sodevrom19-Sep-09 14:06
sodevrom19-Sep-09 14:06 
GeneralRe: Image position in other image c# ? Pin
Dave Kreskowiak19-Sep-09 14:13
mveDave Kreskowiak19-Sep-09 14:13 
GeneralRe: Image position in other image c# ? Pin
Alan Balkany21-Sep-09 10:12
Alan Balkany21-Sep-09 10:12 
AnswerRe: Image position in other image c# ? Pin
Albond22-May-10 10:27
Albond22-May-10 10:27 
QuestionHow to monitor key pressed? Pin
p3rson19-Sep-09 11:06
p3rson19-Sep-09 11:06 
AnswerRe: How to monitor key pressed? Pin
Christian Graus19-Sep-09 11:19
protectorChristian Graus19-Sep-09 11:19 
GeneralRe: How to monitor key pressed? Pin
p3rson19-Sep-09 11:40
p3rson19-Sep-09 11:40 

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.