473,320 Members | 2,180 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,320 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 5182
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: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.