Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 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 July 14th, 2005, 06:53 PM
Authorized User
 
Join Date: Jun 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to aowen355
Default C#--XPath Variables

I have a C# script and inside this script I am executing an XPATH Query:
cmd.CommandText = "INC[Incident/IncidentLocation/j:LocationCityName = cName];

cName is a variable being set by user input, I just need to know how i would specify cName in this path so that it will look to the value of the variable?
Is this possible

 
Old July 15th, 2005, 07:46 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Simply concatenate the values to build the query:

cmd.CommandText = "INC[Incident/IncidentLocation/j:LocationCityName='" + cName + "']";

-Peter





Similar Threads
Thread Thread Starter Forum Replies Last Post
Xpath help please rishid XML 1 February 28th, 2007 03:23 AM
XPATH pallone XSLT 4 November 19th, 2006 07:50 PM
XPath help migake XSLT 2 April 21st, 2006 10:49 AM
Xpath Ma7T XSLT 2 August 16th, 2005 07:54 AM
XPath rupen XML 2 April 19th, 2005 09:43 AM





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