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
Serign Bah
NA
6
1.6k
Using VC++ MFC diaglog to retrieve data from database:
May 9 2016 1:48 PM
Hello Everyone,
I used the following code in C# using Windows Form Application to retrieve data from a database, and i works well, but I could I use similar code to do the same in VC++ MFC dialog?
Code in C# Windows Form Application:
using (SqlConnection c = new SqlConnection(Properties.Settings.Default.In_OutConnectionString))
{
c.Open();
DateTime startDateTime = Convert.ToDateTime(textBox1.Text);
DateTime endDateTime = Convert.ToDateTime(textBox2.Text);
string query = "SELECT * FROM People_Tracking WHERE Enter_Exit_Time BETWEEN @startDateTime AND @endDateTime ;";
SqlCommand cmd = new SqlCommand(query, c);
cmd.Parameters.Add("@startDateTime", SqlDbType.DateTime).Value = startDateTime;
cmd.Parameters.Add("@endDateTime", SqlDbType.DateTime).Value = endDateTime;
SqlDataAdapter adapter = new SqlDataAdapter(cmd);
DataTable t = new DataTable();
adapter.Fill(t);
dataGridView1.DataSource = t;
}
}
MFC dialog screen shot :
My database screen shot:
Reply
Answers (
0
)
Please what's wrong here???
Role Based Login Using angularjs in ASP(MVC) Dot Net