473,396 Members | 2,011 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

problem with dataAdapter

29
Hello

i have this code

DataAdapter = new SqlDataAdapter("select name from CDS where Id='" + TextBox1.Text + "'", mycon);

how can i view the value in textbox 2 ?????????????????

i mean the value that returned from the sql

the value of name's Column
Feb 28 '07 #1
8 1019
kenobewan
4,871 Expert 4TB
Have you tried executing the command? Please post the code that you are using and any errors that you are receiving. Thanks.
Mar 1 '07 #2
MCPD
29
i know that if i use sqlCommand i can use excute

but if i have a dataAdapter i cant excute it

this the full Code

Expand|Select|Wrap|Line Numbers
  1. public partial class _Default : System.Web.UI.Page 
  2. {
  3.     DataSet MyDataSet = null;
  4.     SqlConnection mycon = null;
  5.     SqlDataAdapter DataAdapter = null;
  6.     protected void Page_Load(object sender, EventArgs e)
  7.     {
  8.         mycon = new SqlConnection("Data Source=.;Initial Catalog=CDDB;Integrated Security=True");
  9.         DataAdapter = new SqlDataAdapter("select name from CDS where Id='" + TextBox1.Text + "'", mycon);
  10.         MyDataSet = new DataSet();
  11.         DataAdapter.Fill(MyDataSet);
  12.     }
  13.     protected void Button1_Click(object sender, EventArgs e)
  14.     {
  15.         if (MyDataSet.Tables[0].Rows.Count>0)
  16.         {
  17.             TextBox2.Text = "" +
  18.         }
  19.     }
  20. }
what i should to type here
TextBox2.Text = "" +

to get what returned the adapter and put it into textbox2 ?!?!?!
Mar 1 '07 #3
radcaesar
759 Expert 512MB
Try to use Datagrid there.

Since the returned object which u r trying to use is DataSet, not string.

If u want to work around (To make it as string and then assign it to the text box with some RegEx in between the data), then u have to navigate the dataset by dataset-->Table-->Column-->Row-->Value

:)
Mar 1 '07 #4
kenobewan
4,871 Expert 4TB
radcaesar is right, otherwise if you want to write to string you will need to use a datareader instead.
Mar 1 '07 #5
MCPD
29
can u please tell me how to get string not data set ?

can u write the code because i am new in c# just 2 month learning ??

thanx very much
Mar 1 '07 #6
MCPD
29
any help????
Mar 1 '07 #7
RedSon
5,000 Expert 4TB
can u please tell me how to get string not data set ?

can u write the code because i am new in c# just 2 month learning ??

thanx very much
No one is going to write the code for you. You need to be responsible for your own work. As suggested above to get string information you might be able to use DataReader, by the same token if you wanted to make string information you might try searching for something like a DataWriter. It seems logical that those two classes might have similar functionality except in different directions.
Mar 1 '07 #8
MCPD
29
thanx alot for u all

i learned new things from u all

i searched about the dataReader at the internet and i learn it

if any one have any info. about DataWriter i will thankfull

thnx for all moderators
Mar 1 '07 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: hch | last post by:
dataAdapter.Update(data, "TableName") won’t work! I was about to deploy my first website on the Internet only to discover that the dataAdapter.Update() throws the Server Error in the third...
0
by: Greenwich Support | last post by:
Hi All, I have a very weird problem which is occurring with a VB.Net app and PostgreSQL 7.3.1. There is a form that has a standard .Net datagrid on it that contains some data from a table in...
1
by: Steven Blair | last post by:
Hi, Here is a short decsription of my problem. I have written a dll for Database accessing. I have one method which can return a Dataset and another method which takes a Dataset and upates a...
0
by: Steve Bishop | last post by:
I have a form with a search text box and a grid that displays the results. Within the grid, I have edit command links set up to response.redirect to another page that puts the DataKey value in the...
3
by: crjunk | last post by:
I have 4 different databases that I'm having to pull data from in order to populate a datagrid. I am able to do this, but my problem is that because I'm pulling the data from 4 different...
11
by: Siv | last post by:
Hi, I seem to be having a problem with a DataAdapter against an Access database. My app deletes 3 records runs a da.update(dt) where dt is a data.Datatable. I then proceed to update a list to...
3
by: Rich | last post by:
What is the diffeence bewtween a dataAdapter.InsertCommand and dataAdapter.SelectCommand (and dataAdapter.UpdateCommand for that matter)? Dim da As SqlDataAdapter conn.Open da.SelectCommand =...
5
by: Emil | last post by:
I've created a very simple data base in Microsoft Access 2003. It consists of only one table called "Students" and it contains 2 information about each student: id-student and name. When I try...
1
by: BobLewiston | last post by:
I’m trying to learn how to connect to an SQL Server database (I’m using the AdventureWorks sample database), but I’m having problems. Here’s the code I’m using: // define connection string for...
2
by: BobLewiston | last post by:
I can read in an SQL table ("Person.Contact") from AdventureWorks and step through it one row at a time, but when I try to save a record, either one I'm inserting or one I'm editting, I get the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.