borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (Start Learning VB)Next Topic (C++ FREE PDF EBOOK) New Topic New Poll Post Reply
AndreaVB Forum : C# : How to know column Name
Poster Message
bdeshtiger
Level: Trainee

Registered: 04-06-2007
Posts: 1

icon How to know column Name

Dear All,

I just jumped from Vb to C#. How can i know column name under a dataset?

common class for recordset save:

using System.Data.OleDb;
public string conStr= @"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=..\\database.mdb";
cnn = new OleDbConnection(conStr);
cnn.open();
da = new OleDbDataAdapter("select * from " + sTableName, cnn);
ds = new DataSet();
da.Fill(ds, sTableName);

till here it works fine. The above code is under a class (rs)...

The problem i am fetching is here:
string lssql;
lssql = "update " + tablename + " set " + i_should_know_the_column_name + "='" +
                txtDescription.Text + "' where " + columnname = textbox1.text
rs.dataSave(lssql);

**i_should_know_the_column_name --> how to know the column name rs.ds.table(column(1)). Can anyone help me in this regards.

I am using VS2005, MSACCESS, WinXP32bit

Thanks in advance

BT  

04-06-2007 at 11:12 PM
View Profile Send Email to User Show All Posts | Quote Reply
stickleprojects
Level: Moderator


Registered: 09-09-2002
Posts: 891
icon Re: How to know column Name

Hi,
Try

ds[tablename].DataColumns[1].Name


____________________________
Build it better, faster, quicker, easier.. then fix it (non-offical MS mission statement)

14-06-2007 at 11:46 AM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : C# : How to know column Name
Previous Topic (Start Learning VB)Next Topic (C++ FREE PDF EBOOK) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder