TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Lukasz
NA
2
0
object does not exist in the current context
Jul 3 2006 8:23 AM
Please help me with this code. During compilation i got the error:
Error 1 The name 'ds' does not exist in the current context : How should I delcare DataSet?
thx
-----------------------------------------------
public
void
listBox1_SelectedIndexChanged(
object
sender,
EventArgs
e)
{
OleDbDataAdapter
dataadapt =
new
OleDbDataAdapter
();
DataSet
ds =
new
DataSet
();
StringBuilder
sbConn =
new
StringBuilder
();
sbConn.Append(
@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
+ openFileDialog1.FileName);
sbConn.Append(
";Extended Properties="
);
sbConn.Append(
Convert
.ToChar(34));
sbConn.Append(
"Excel 8.0;HDR=Yes;IMEX=2"
);
sbConn.Append(
Convert
.ToChar(34));
OleDbConnection
cnExcel =
new
OleDbConnection
(sbConn.ToString());
cnExcel.Open();
string
exle =
"select * from ["
+kokon+
"]"
;
dataadapt =
new
OleDbDataAdapter
(exle, sbConn.ToString());
dataadapt.Fill(ds,
"symbol"
);
this
.dataGridView1.DataSource = ds;
this
.dataGridView1.DataMember =
"symbol"
;
}
public
void
button2_Click(
object
sender,
EventArgs
e)
{
FileStream
filestr =
new
FileStream
(
"mlout.xml"
,
FileMode
.OpenOrCreate,
FileAccess
.Write);
ds.WriteXml(filestr);
}
----------------------------
Reply
Answers (
1
)
How to encrypt and decrypt using C# in window base programme
Ports in c#.net