Created
October 8, 2015 18:33
-
-
Save SajjadArifGul/41fa0a5d5983210f92ea to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Data.SqlClient; | |
using System.Drawing; | |
using System.Data; | |
using System.IO; | |
using System.Windows.Forms; | |
namespace Project_Invoice | |
{ | |
class Query | |
{ | |
public string StMesg; | |
public void Conect(string AddQuery, string Path) | |
{ | |
ManagerForm f1 = new ManagerForm(); | |
SqlConnection con = new SqlConnection(Path); | |
con.Open(); | |
SqlCommand com = new SqlCommand(AddQuery, con); | |
var RowEfected = com.ExecuteNonQuery(); | |
con.Close(); | |
if (RowEfected > 0) | |
{ | |
StMesg = "Data Saved Successfully"; | |
} | |
else | |
{ | |
StMesg = "ALERT : Data Not Saved !!!"; | |
} | |
} | |
public int DataReadrint(string AddQuery, string Path) | |
{ | |
int Num = 0; | |
SqlConnection con = new SqlConnection(Path); | |
con.Open(); | |
SqlCommand com = new SqlCommand(AddQuery, con); | |
SqlDataReader sdr = com.ExecuteReader(); | |
while (sdr.Read()) | |
{ | |
Num = sdr.GetInt32(0); | |
} | |
con.Close(); | |
return Num; | |
} | |
public string DataReadrstring(string AddQuery, string Path) | |
{ | |
string Word = "a"; | |
SqlConnection con = new SqlConnection(Path); | |
con.Open(); | |
SqlCommand com = new SqlCommand(AddQuery, con); | |
SqlDataReader sdr = com.ExecuteReader(); | |
while (sdr.Read()) | |
{ | |
Word = sdr.GetString(0).ToString(); | |
} | |
con.Close(); | |
return Word; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment