Wrox Programmer Forums
|
ASP.NET 1.x and 2.0 Application Design Application design with ASP.NET 1.0, 1.1, and 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.x and 2.0 Application Design 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 November 4th, 2004, 05:29 PM
Authorized User
 
Join Date: Oct 2004
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem of vale setting


I have this .NET (VB) code:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load


Dim myConnection As New SqlConnection(ConnectionString)
myConnection.Open()

Dim CommandText As String = "SELECT firstName FROM students Where Students.ID='" & IDinput & "' "

Dim myCommand As New SqlCommand(CommandText, myConnection)

'****this the problem, somthing is mising here******
Dim name As String = myCommand.ExecuteReader(CommandBehavior.CloseConne ction)

end sub


The SQL qurey return only one record each time (only one student name with specific ID number)

I want that variable "name" will get the value of the "firstName" filed.



How to do it??



 
Old November 4th, 2004, 06:28 PM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post
Default

try thi code,
Code:
int i=0;
String name = myCommand.ExecuteReader.GetString(i);
//i is the zero based column ordinal,here you should set it to 0
HtH.


_____________________________
Mehdi.
software engineering student.
Looking for a good job for summer 2005.





Similar Threads
Thread Thread Starter Forum Replies Last Post
problem setting a variable jtrifts Javascript 4 August 9th, 2007 08:36 AM
problem in setting the classpath. Sibananda Tripathy J2EE 1 May 2nd, 2007 01:08 AM
Problem with setting up the projects bharat991 BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 5 July 14th, 2006 07:57 AM
problem while setting parametername while using re geetageetageeta ASP.NET 2.0 Basics 0 March 3rd, 2006 02:31 AM
Problem regarding setting up Privilege Mimt MySQL 6 August 19th, 2004 04:09 PM





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