Solved

Setting a string variable as a dataset field value

Posted on 2004-08-05
7
282 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
  • 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Best way to handle data being sent over a serial COM 5 32
System32Int Error 8 57
vb.net 2 37
Extracting last characters in a substring 5 21
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

863 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

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now