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
hadoop hadoop
NA
159
51.1k
generate LINQ module from this C# module for data set
May 29 2015 2:25 AM
I am trying to change the below code as LINQ. But I am unable to do this, please guide me.
private void getData(AutoCompleteStringCollection dataCollection)
{
string connetionString = null;
SqlConnection connection ;
SqlCommand command ;
SqlDataAdapter adapter = new SqlDataAdapter();
DataSet ds = new DataSet();
connetionString = "Data Source=.;Initial Catalog=pubs;User ID=sa;password=zen412";
string sql = "SELECT DISTINCT [fname] FROM [employee]";
connection = new SqlConnection(connetionString);
try
{
connection.Open();
command = new SqlCommand(sql, connection);
adapter.SelectCommand = command;
adapter.Fill(ds);
adapter.Dispose();
command.Dispose();
connection.Close();
foreach (DataRow row in ds.Tables[0].Rows)
{
dataCollection.Add(row[0].ToString());
}
}
catch (Exception ex)
{
MessageBox.Show("Can not open connection ! ");
}
}
I want to get the
user_name
from my
AppUser
table. How can I do this?
Reply
Answers (
1
)
style and apperance of ribbon control
Directory Information in VB.Net