• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 329
  • Last Modified:

Setting a string variable as a dataset field value

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
originsone
Asked:
originsone
  • 3
  • 2
  • 2
2 Solutions
 
jrandallsextonCommented:
Do you mean how do you get the values out of the dataset and put it into the variable?
0
 
DotNetLover_BaanCommented:
The concept of "Data Binding" is ONLY for controls. In broader sense, Control is nothing but a variable.
0
 
originsoneAuthor Commented:
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
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

 
jrandallsextonCommented:
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
 
DotNetLover_BaanCommented:
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
 
jrandallsextonCommented:
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
 
originsoneAuthor Commented:
Thanks! This is exactly the information i need. This is why I pay $10 a month.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now