473,289 Members | 1,947 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,289 software developers and data experts.

Asp .Net C# : Table name in Datatable

hello

i am new i vb.net. i am working in .net concern i want to fetch datas from sql i gave the coind as below

Expand|Select|Wrap|Line Numbers
  1. SqlConnection connection;
  2.         connection = new SqlConnection();
  3.         connection.ConnectionString = "Persist Security Info=False;" +
  4.         "Integrated Security=SSPI;database=northwind;" +
  5.         "server=localhost;Connect Timeout=30";
  6.         connection.Open();
  7.         SqlDataAdapter dataadapter;
  8.         dataadapter = new SqlDataAdapter("select * from employee", connection);
  9.         DataSet ds; 
  10.         ds = new DataSet();
  11.         dataadapter.Fill(ds, "table1");
  12.         //dataGrid1.DataSource = dataset;
  13.         //so once ur dataset is filled then from that pick one value
  14.         //textbox1.text = dataset.tables("table1").columns("colname")
  15.         TextBox1.text = ds.Tables[0].Columns[0][1].ToString();
  16.         TextBox2.text = ds.Tables[0].Columns[0][1].ToString(); 
but it is showing error in

TextBox1.text = ds.Tables[0].Columns[0][1].ToString();
TextBox2.text = ds.Tables[0].Columns[0][1].ToString();

as

'System.Web.UI.WebControls.TextBox' does not contain a definition for 'text'

can u clear that error and send me the correct source

and i want to know what is "table1" in

dataadapter.Fill(ds, "table1");
is it the table name...

please clear my doubts as soon as possible

regards
Nov 22 '07 #1
2 5181
Shashi Sadasivan
1,435 Expert 1GB
hi,
Seems you have copied the code from somewhere.
Remeber that C# is a case sensitive language.

This is not a problen from your dataset or the way you have writteen it.

replace "text" by "Text".
Notice the capital T in Text.

reg table name: table1 is the table name that is referenced in your datatable. However i am not entirely sure if it is necessary to do so.
The other thing i noticed in your post is your code is in c# and you expect the code be ammended in C# but you also talk abt being into vb .net!
is that why the case sensitivness went away?

Welcome to TSDN.
Please do read the Posting Guidelines in the FAQ section and make use of the code tags so that your code looks appealing to other members who would like to learn / reply to your message

- Shashi
Nov 22 '07 #2
hi sashi

i changed it but even though it is not fetching the records...

it doesnt show error...

then i have wrote stored procedure for fetching the stored procedure is working

but i dont know how call the stored procedure in c#...

my need is, i am having a table employee which contains 2 fields

eid and ename i want to fetch the details of ename using eid in frontend using c#....

my stored procedure is

create procedure pro2
@eid int
as
select * from employee where eid=@eid

can u send me the source code in c#..
Nov 22 '07 #3

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

Similar topics

3
by: Antonio Ooi | last post by:
Hi, I get a DataTable based on this simple query: SELECT * FROM Customers Later, I want to know just the table name because I do not want to play with the string within the SELECT statement....
2
by: Jacob | last post by:
A simple question: I've read a couple of things that indicates I can create a new table in my database using some SQL command. Is this correct? I would like to load a database into a DataSet,...
3
by: Marty McDonald | last post by:
I have <asp:Table... </asp:Table> on my webform. In codebehind, I populate a DataTable whose data should appear in the asp:Table. I created my own code to populate the asp:Table with the...
1
by: ruca | last post by:
Hi, I have this code: -------------------------------------------- Dim myDataSet As DataSet myDataSet = New DataSet("Funcionarios") ' Create two DataTable objects using a function. Dim...
1
by: kingster | last post by:
Hi, I have a regular dataset and all i want to do is make a pivot table display in a browser with the datasource of the pivot table to be this dataset and then the end-user will be able to do...
9
by: dba123 | last post by:
I need some help and direction on what classes and an example or two (article) on how to read an Excel Worksheet and insert one column into a database table column. I am using .NET 2.0 only. What...
1
by: Chris | last post by:
Hi, I'm using the following code DataTable tables = ((OleDbConnection)oleconn).GetOleDbSchemaTable( OleDbSchemaGuid.Tables, new object { null, null, null, "TABLE" }); foreach (DataRow r in...
0
by: Chris | last post by:
I have a DataGridView in a form that will display the information from various DataTables in my DataSet. The user is provided a list of tables and when they select a table name, the DataGridView...
4
by: svgeorge | last post by:
I NEED TO COLLECT FROM THE GRIDVIEW(DATASELECTED) IN TO A TABLE(SelectedPayment) -------------------------------------------------------------------------------- How TO COLLECT THE ROWS...
1
by: TG | last post by:
Hi! I have an application in which I have some checkboxes and depending which ones are checked those columns will show in the datagridview from sql server or no. After that I have 2 buttons:...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

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.