Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 2008 > C# 2008 aka C# 3.0
|
C# 2008 aka C# 3.0 Discuss the Visual C# 2008 (aka C# 3.0) language
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2008 aka C# 3.0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 31st, 2010, 09:02 PM
Authorized User
 
Join Date: Feb 2010
Posts: 18
Thanks: 0
Thanked 1 Time in 1 Post
Default C#.Net 2008 SQL WHERE Clause problem

Hi Good Guys,

Encountering another puzzling problem. Never happened before when using VB.NET.

It regarding using a strCustID as variable in the SQL WHERE clause and it generate error message:

Here are the Coding.
Code:
   private String FCreateSQLString( ) 
        {
            string strCustID = listBoxCust.SelectedItem(0).ToString;
            string strSql;

            strSql +=  "Select OrderID, ShipName, ";
            strSql +=  "Convert(char(10), OrderDate, 103) as OrderDate, ";
            strSql +=  "Convert(char(10), ShippedDate, 103) as ShipDate, ";
            strSql +=  "From Orders ";
            strSql += " WHERE  O.customerID = '" & strCustID & "'";
                          
            return strSql;
            
        }


-----------------------------------
This coding also cause problem,
string strCustID = listBoxCust.SelectedItem(0).ToString;
I am trying to retrieve the CustomerId from the Listbox whose structure is

this.listBoxCust.DisplayMember = "CompanyName";
this.listBoxCust.ValueMember = "CustomerID";
this.listBoxCust.DataSource = DS.Tables["Cust"];
__________________


Thank you very much.

Have a good day.

Cheers,
Lennie





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to use SQL Expression Fields of Crystal Report 11.5 from VB.NET 2008 Tareqdhk Crystal Reports 0 March 15th, 2010 06:57 AM
Stored Procedure Not Returning Same Value As Inline Sql VB.Net 2008 slbibs ADO.NET 6 March 11th, 2010 04:16 AM
Has anyone got this working with VWDE 2008 / SQL Express 2008? john77 BOOK: ASP.NET 3.5 Website Programming Problem Design Solution 4 January 18th, 2010 01:16 PM
ASP.NET 2008 WITH C#.NET 2008 N-TIER APPLICATION Honorable ASP.NET 3.5 Basics 6 May 24th, 2009 07:26 AM
SQL 2008 will not run on Windows 2008? dkrus Book: Professional Microsoft SQL Server 2008 Administration ISBN: 978-0-470-24796-9 1 February 23rd, 2009 12:34 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.