Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 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 June 3rd, 2005, 05:32 AM
Registered User
Join Date: May 2005
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default SQL string in C#

I'm trying to output an sql string in Visual C#.NET. What is giving me problems is that I want to reference an integer variable I have already assigned eg.

int FacilityPage = GetParentId;

string SqlTest = "SELECT * FROM content[Mode] WHERE parentId=FacilityPage and classId='new'";
rptTest.Sql = SqlTest;

It compiles ok but I keep getting errors stating that FacilityPage is not a valid column name.

Can someone help me on this?


Old June 4th, 2005, 12:28 AM
Friend of Wrox
Join Date: Jun 2004
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76

you need to put like this C# cannot interpret the contents of your string

string SqlTest = "SELECT * FROM content[Mode] WHERE parentId=" + FacilityPage.ToString() + " and classId='new'";

Similar Threads
Thread Thread Starter Forum Replies Last Post
problems with my SQL string dstein4d Access VBA 9 September 19th, 2008 01:50 PM
SQL connection string naeem.net SQL Server ASP 0 July 10th, 2007 02:17 PM
save the sql string g2000 ASP.NET 2.0 Basics 1 February 13th, 2006 01:09 PM
SQL String Parsing TdyIndy SQL Language 2 July 26th, 2004 10:47 PM
SQL String question kilika SQL Server 2000 11 December 3rd, 2003 02:28 PM

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