473,396 Members | 1,683 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Problem with SELECT Statement

I have a select statement that isn’t functioning properly:

private void Page_Load(object sender, System.EventArgs e)

{

myClubNow1=new
DateTime(DateTime.Now.Year,DateTime.Now.Month,Date Time.Now.Day);

dsClub=new DataSet();

string
strClubconn=ConfigurationSettings.AppSettings["ConnectionString"];

ClubConn=new SqlConnection(strClubconn);

ClubConn.Open();

string strClubcmdRead="SELECT EVNR_tbl.* FROM EVNR_tbl
WHERE EVNR_tbl._Date BETWEEN '" + myClubNow1.Date.ToString("dd/MM/yyyy") + "'
AND '" + myClubNow1.Date.AddDays(3).ToString("dd/MM/yyyy") + "'";

clubAdapt=new SqlDataAdapter(strClubcmdRead, ClubConn);

clubAdapt.Fill(dsClub,"EVNR_tbl");

Repeater1.DataSource=dsClub;

Repeater1.DataBind();

ClubConn.Close();

}

When I debug it shows the proper dates but at run-time when the site comes
up it doesn’t return any event information even though I know the table
EVNR_tbl has information. The Structure of the data table is as follows:

Column Name datatype example

EVNRID int 1

_Date DateTime 04/03/2005

Duration int 1

Broadcast bit 0

EventTitle char(255) Vivid's last night

Description Text Last night etc etc

Details Text Etc etc etc

I don’t know why it is not returning any data on the web site when I know
there are records. It was working yesterday. Please help.

Nov 19 '05 #1
1 1007
This should be switched over to parameterized queries or stored procedures if
this is going to be real production code. To get it working currently,
change the first line to

myClubNow1 = DateTime.Now; // this is more readable than what you have

and change your select statement to use the one true date format
("yyyyMMdd")

01/02/03 can mean different things depending on your regional settings.
Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Nicolas Payre | last post by:
Hi, I have the following SQL that I want to use to update a table. It doesn't work ! Does someone knows why? ** I Know it could be done easy with a CURSOR FOR LOOP, but still... Thanks for...
5
by: Ritesh | last post by:
Hi All, According to my observation using SP_WHO2 in my database, some INSERT statements are getting blocked by SELECT statements. Though the blocking SELECT statement is having ReadPast hint,...
15
by: Hemant Shah | last post by:
Folks, We have an SQL statement that was coded in an application many years ago (starting with DB V2 I think). When I upgraded to UDB 8.2, the optimizer does not use optimal path to access the...
1
by: tom.eeraerts | last post by:
Hello, I have a problem migrating an application from v5r2 to v5r3. The problem is with the prepared statements. To see what the problem is, i extracted a small piece of code and debugged the...
3
by: shark | last post by:
Hi all. i am facing a deadlock problem .i have included the -t1204 and -T3605 trace flags and have got the following o/p pu tin sqls server logs. 2006-06-01 17:49:21.84 spid4 2006-06-01...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.