Click here to Skip to main content
16,016,227 members
Home / Discussions / C#
   

C#

 
GeneralRe: Best practise for using EF Entities Pin
Dave Kreskowiak5-Feb-14 15:17
mveDave Kreskowiak5-Feb-14 15:17 
GeneralRe: Best practise for using EF Entities Pin
Shady George6-Feb-14 9:38
Shady George6-Feb-14 9:38 
GeneralRe: Best practise for using EF Entities Pin
Dave Kreskowiak6-Feb-14 9:53
mveDave Kreskowiak6-Feb-14 9:53 
GeneralRe: Best practise for using EF Entities Pin
Shady George6-Feb-14 10:17
Shady George6-Feb-14 10:17 
GeneralRe: Best practise for using EF Entities Pin
Shady George6-Feb-14 11:50
Shady George6-Feb-14 11:50 
GeneralRe: Best practise for using EF Entities Pin
Dave Kreskowiak6-Feb-14 12:14
mveDave Kreskowiak6-Feb-14 12:14 
AnswerRe: Best practise for using EF Entities Pin
cseder2-Feb-14 15:23
cseder2-Feb-14 15:23 
QuestionC# and databse connectivity issue urgent?? Pin
Member 105648501-Feb-14 2:58
Member 105648501-Feb-14 2:58 
here is my code:
public partial class Form1 : Form
{
string cs = @"Data Source=NADEEM-PC\SQLEXPRESS;Initial Catalog=School Managment System;Integrated Security=True";
static SqlConnection con = null;
static SqlCommand cmd = null;
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{

}
void Summary()
{
int Male_students;
int Female_students;
int Male_teachers;
int Female_teachers;
con = new SqlConnection(cs);
con.Open();

try
{
cmd = new SqlCommand("SELECT COUNT(*) FROM [Students Records] WHERE Gender='Male' ", con);
Male_students = int.Parse(cmd.ExecuteScalar().ToString());

cmd = new SqlCommand("SELECT COUNT(*) FROM [Students Records] WHERE Gender='Female' ", con);
Female_students = int.Parse(cmd.ExecuteScalar().ToString());


cmd = new SqlCommand("SELECT COUNT(*) FROM [Teachers Records] WHERE Gender='Male' ", con);
Male_teachers = int.Parse(cmd.ExecuteScalar().ToString());

cmd = new SqlCommand("SELECT COUNT(*) FROM [Teachers Records] WHERE Gender='Female' ", con);
Female_teachers = int.Parse(cmd.ExecuteScalar().ToString());

this.SM.Text = "" + Male_teachers.ToString() + "";
this.SF.Text = "" + Female_teachers.ToString() + "";
this.ST.Text = "" + (Male_teachers + Female_teachers).ToString() + "";

this.TM.Text = "" + Male_students.ToString() + "";
this.TF.Text = "" + Female_students.ToString() + "";
this.TT.Text = "" + (Male_students + Female_students).ToString() + "";

con.Close();
}
catch (System.Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
if (con.State == ConnectionState.Open)
{
con.Close();
}
}

}
}
i don't get the desire result on labels named SM,SF,ST,TM,TF,TT
please help me.. Frown | :( .
AnswerRe: C# and databse connectivity issue urgent?? Pin
OriginalGriff1-Feb-14 3:09
mveOriginalGriff1-Feb-14 3:09 
GeneralRe: C# and databse connectivity issue urgent?? Pin
Member 105648501-Feb-14 3:14
Member 105648501-Feb-14 3:14 
GeneralRe: C# and databse connectivity issue urgent?? Pin
OriginalGriff1-Feb-14 3:18
mveOriginalGriff1-Feb-14 3:18 
GeneralRe: C# and databse connectivity issue urgent?? Pin
Member 105648501-Feb-14 3:23
Member 105648501-Feb-14 3:23 
GeneralRe: C# and databse connectivity issue urgent?? Pin
OriginalGriff1-Feb-14 3:30
mveOriginalGriff1-Feb-14 3:30 
GeneralRe: C# and databse connectivity issue urgent?? Pin
Member 105648501-Feb-14 3:35
Member 105648501-Feb-14 3:35 
GeneralRe: C# and databse connectivity issue urgent?? Pin
OriginalGriff1-Feb-14 3:46
mveOriginalGriff1-Feb-14 3:46 
GeneralRe: C# and databse connectivity issue urgent?? Pin
Member 105648501-Feb-14 3:53
Member 105648501-Feb-14 3:53 
GeneralRe: C# and databse connectivity issue urgent?? Pin
OriginalGriff1-Feb-14 3:58
mveOriginalGriff1-Feb-14 3:58 
RantRe: C# and databse connectivity issue urgent?? Pin
Eddy Vluggen1-Feb-14 7:04
professionalEddy Vluggen1-Feb-14 7:04 
QuestionIMultiValueConverter and IValueConverter Interface lagging (slowness) Pin
cpquest1-Feb-14 2:33
cpquest1-Feb-14 2:33 
AnswerRe: IMultiValueConverter and IValueConverter Interface lagging (slowness) Pin
Eddy Vluggen1-Feb-14 7:00
professionalEddy Vluggen1-Feb-14 7:00 
GeneralRe: IMultiValueConverter and IValueConverter Interface lagging (slowness) Pin
cpquest2-Feb-14 16:31
cpquest2-Feb-14 16:31 
GeneralRe: IMultiValueConverter and IValueConverter Interface lagging (slowness) Pin
Eddy Vluggen2-Feb-14 22:38
professionalEddy Vluggen2-Feb-14 22:38 
AnswerRe: IMultiValueConverter and IValueConverter Interface lagging (slowness) Pin
Pete O'Hanlon2-Feb-14 23:50
mvePete O'Hanlon2-Feb-14 23:50 
QuestionConsuming sqlcompact connection with using statement Pin
teknolog1231-Feb-14 2:21
teknolog1231-Feb-14 2:21 
AnswerRe: Consuming sqlcompact connection with using statement Pin
Eddy Vluggen1-Feb-14 6:52
professionalEddy Vluggen1-Feb-14 6:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.