Solved

Setting a string variable as a dataset field value

Posted on 2004-08-05
7
311 Views
Last Modified: 2010-04-23
How do I assign a string variable to a dataset field value. I am attaching to a SQL server, so I am using a SQLConnection, SQLDataAdapter, and a DataSet. Currently I am having to bind the field to a hidden text box. I really do not like this. Any ideas?
0
Comment
Question by:originsone
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 
LVL 4

Expert Comment

by:jrandallsexton
ID: 11726995
Do you mean how do you get the values out of the dataset and put it into the variable?
0
 
LVL 18

Expert Comment

by:DotNetLover_Baan
ID: 11727255
The concept of "Data Binding" is ONLY for controls. In broader sense, Control is nothing but a variable.
0
 

Author Comment

by:originsone
ID: 11727462
Yes jrandallsexton. A variable that is a string.

DotNetLover  Has this changed since VB6? I thought you could assign data to a variable in 6. something like this.

Dim a as String
a = rsConnection!field

Please correct me if I am wrong.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 4

Accepted Solution

by:
jrandallsexton earned 300 total points
ID: 11727507
Do you simply want to iterate the dataset and get the values out?
If so ...

        Dim dr As DataRow
            For Each dr In myDataSet.Tables(0).Rows
                If (condition) Then
                    someVariable = dr.Item(0).ToString
                    someVariable2 = dr.Item(1).ToString
                End If
            Next
0
 
LVL 18

Assisted Solution

by:DotNetLover_Baan
DotNetLover_Baan earned 200 total points
ID: 11727544
originsone ,
this is not binding.... what you are thinking... this is just assigning a field value to a variable. "BINDING" is different, from just assigning a value.
0
 
LVL 4

Expert Comment

by:jrandallsexton
ID: 11727556
Baan is correct.  That is not binding - neither is what I did.

I simply am assigning the values from the dataset to whatever variables you need.
0
 

Author Comment

by:originsone
ID: 11727756
Thanks! This is exactly the information i need. This is why I pay $10 a month.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question