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
jansen Malaggay
NA
9
526
How to use SQL Connection Class in Windows Forms Application
Jun 8 2018 2:50 AM
Hello Guys!
I got adopted this code from this website written by Hammad Maqbool. I found it very interesting but i just want to clarify if how would i going to use this in Windows Forms Applications like in "Try" Statement.
This is the class i modified:
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
using
System.Threading.Tasks;
using
MySql.Data.MySqlClient;
using
System.Data;
namespace
myssfasys
{
public
class
myconnstring1
{
string
ConnString =
"Server=localhost; User Id=root; Password=deityshasm911; Database=ssfasys"
;
MySqlConnection con;
public
void
OpenConection()
{
con =
new
MySqlConnection(ConnString);
con.Open();
}
public
void
CloseConnection()
{
con.Close();
}
public
void
ExecuteQueries(
string
Query_)
{
MySqlCommand cmd =
new
MySqlCommand(Query_, con);
cmd.ExecuteNonQuery();
}
public
MySqlDataReader DataReader(
string
Query_)
{
MySqlCommand cmd =
new
MySqlCommand(Query_, con);
MySqlDataReader dr = cmd.ExecuteReader();
return
dr;
}
public
object
ShowDataInGridView(
string
Query_)
{
MySqlDataAdapter dr =
new
MySqlDataAdapter(Query_, ConnString);
DataSet ds =
new
DataSet();
dr.Fill(ds);
object
dataum = ds.Tables[0];
return
dataum;
}
}
}
I'm just new with programming so please i need help.
Reply
Answers (
2
)
How to show active financial date range active.
How to use YesNo Cancel message box.