Click here to Skip to main content
15,919,500 members
Home / Discussions / C#
   

C#

 
QuestionHow does WebSerice mechanism run? Pin
MehmetFurkan8-Jan-08 3:28
MehmetFurkan8-Jan-08 3:28 
AnswerRe: How does WebSerice mechanism run? Pin
Judah Gabriel Himango8-Jan-08 6:09
sponsorJudah Gabriel Himango8-Jan-08 6:09 
AnswerRe: How does WebSerice mechanism run? Pin
Ennis Ray Lynch, Jr.8-Jan-08 7:20
Ennis Ray Lynch, Jr.8-Jan-08 7:20 
GeneralSystem.OutOfMemoryException Pin
Gareth H8-Jan-08 3:27
Gareth H8-Jan-08 3:27 
GeneralRe: System.OutOfMemoryException Pin
Judah Gabriel Himango8-Jan-08 5:59
sponsorJudah Gabriel Himango8-Jan-08 5:59 
GeneralRe: System.OutOfMemoryException Pin
Not Active8-Jan-08 6:07
mentorNot Active8-Jan-08 6:07 
GeneralRe: System.OutOfMemoryException Pin
Gareth H8-Jan-08 6:39
Gareth H8-Jan-08 6:39 
GeneralClosing the form when there is no records found in dataset c#-winforms Pin
mcirosoftmohan8-Jan-08 3:24
mcirosoftmohan8-Jan-08 3:24 
Hi all,

i'm preparing an exe where i have to get the records from the dataset and display in the listbox.

when there is records then everything is good, when there is no records returned then i have to check the condition in the form load event and i have to close the exe.

this exe will autorun in an installer.

when i close the form in form_load event then the program.cs file is throwing error.


public partial class frmChkStatus : Form
{

public string ConString = string.Empty;
public frmChkStatus()
{

InitializeComponent();
try
{

OdbcConnection strCon = new OdbcConnection();
strCon.ConnectionString = "DSN=STUSTATUS;LOGINID=STU;PWD=ANY";
strCon.Open();


string strExamCnt = "Select DISTINCT ME.stu_NB from MBR_STU ME where Me.STATUS_FL = UPPER('Y')";
OdbcCommand myCommand = new OdbcCommand(strExamCnt, strCon);

DataTable dt = new DataTable();
OdbcDataReader reader = myCommand.ExecuteReader((CommandBehavior.CloseConnection));

dt.Load(reader);

if (dt.Rows.Count <= 0)
{
//lblResult.Text = "No Records Found";
// Application.Exit();
ActiveForm.Hide();

//lstExamCodes.Visible = false;
}
else
{
//lblResult.Text = dt.Rows.Count + " Records found";
lstExamCodes.DataSource = dt;
lstExamCodes.DisplayMember = dt.Columns[0].ColumnName;
}
}
catch (Exception ex)
{
MessageBox.Show("Exception occured while retrieving STUDENTS.", "Status", MessageBoxButtons.OK, MessageBoxIcon.Error);

}

}


private void btnExit_Click(object sender, EventArgs e)
{
frmChkStatus.ActiveForm.Close();
}


}
}

PLEASE LET ME KNOW HOW TO CLOSE THE FORM WHEN THERE IS NO RECORDS AND CONTINUE TO OTHER INSTALLERS EXECUTION

M.MohanVamsi

GeneralRe: Closing the form when there is no records found in dataset c#-winforms Pin
Justin Perez8-Jan-08 3:51
Justin Perez8-Jan-08 3:51 
GeneralRe: Closing the form when there is no records found in dataset c#-winforms Pin
mcirosoftmohan8-Jan-08 4:23
mcirosoftmohan8-Jan-08 4:23 
GeneralRe: Closing the form when there is no records found in dataset c#-winforms Pin
mcirosoftmohan8-Jan-08 4:39
mcirosoftmohan8-Jan-08 4:39 
GeneralRe: Closing the form when there is no records found in dataset c#-winforms Pin
Justin Perez8-Jan-08 4:42
Justin Perez8-Jan-08 4:42 
GeneralRe: Closing the form when there is no records found in dataset c#-winforms Pin
mcirosoftmohan8-Jan-08 5:12
mcirosoftmohan8-Jan-08 5:12 
Generaldisable enter button Pin
eyeseetee8-Jan-08 3:18
eyeseetee8-Jan-08 3:18 
GeneralRe: disable enter button Pin
Matthew Butler8-Jan-08 3:47
Matthew Butler8-Jan-08 3:47 
GeneralRe: disable enter button Pin
eyeseetee8-Jan-08 3:56
eyeseetee8-Jan-08 3:56 
GeneralRe: disable enter button Pin
Matthew Butler8-Jan-08 4:07
Matthew Butler8-Jan-08 4:07 
GeneralRe: disable enter button Pin
eyeseetee8-Jan-08 4:09
eyeseetee8-Jan-08 4:09 
GeneralRe: disable enter button Pin
Matthew Butler8-Jan-08 4:14
Matthew Butler8-Jan-08 4:14 
GeneralRe: disable enter button Pin
eyeseetee8-Jan-08 4:20
eyeseetee8-Jan-08 4:20 
GeneralRe: disable enter button Pin
Matthew Butler8-Jan-08 4:34
Matthew Butler8-Jan-08 4:34 
GeneralRe: disable enter button Pin
eyeseetee8-Jan-08 4:47
eyeseetee8-Jan-08 4:47 
QuestionNeed Help Pin
Saiyed Alam8-Jan-08 3:13
Saiyed Alam8-Jan-08 3:13 
GeneralRe: Need Help Pin
Justin Perez8-Jan-08 3:56
Justin Perez8-Jan-08 3:56 
GeneralRe: Need Help Pin
Saiyed Alam8-Jan-08 4:35
Saiyed Alam8-Jan-08 4:35 

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.