Click here to Skip to main content
15,902,938 members
Home / Discussions / C#
   

C#

 
GeneralRe: variables not being maintained in Visual C# 2008 Express Edition between two paint event handlers Pin
Christian Graus26-Aug-09 15:57
protectorChristian Graus26-Aug-09 15:57 
GeneralRe: variables not being maintained in Visual C# 2008 Express Edition between two paint event handlers Pin
N a v a n e e t h26-Aug-09 16:06
N a v a n e e t h26-Aug-09 16:06 
GeneralRe: variables not being maintained in Visual C# 2008 Express Edition between two paint event handlers Pin
Christian Graus26-Aug-09 16:18
protectorChristian Graus26-Aug-09 16:18 
GeneralRe: variables not being maintained in Visual C# 2008 Express Edition between two paint event handlers Pin
Jim Darrah27-Aug-09 4:46
Jim Darrah27-Aug-09 4:46 
QuestionKeep application settings on version change Pin
souren7726-Aug-09 14:09
souren7726-Aug-09 14:09 
AnswerRe: Keep application settings on version change Pin
Henry Minute26-Aug-09 14:41
Henry Minute26-Aug-09 14:41 
QuestionTyped Dataset replacing existing relationship for dynamic one throws: The row doesn't belong to the same DataSet as this relation [modified] Pin
Nohcs77726-Aug-09 13:53
Nohcs77726-Aug-09 13:53 
QuestionSQLCE C# Not Selecting New Records Pin
hobbsieoz26-Aug-09 11:11
hobbsieoz26-Aug-09 11:11 
I am developing a C# Windows Application which inserts data into a SQLCE database.

It inserts fine, that works great!

However, if i want to select the new record from the database, it comes back as a blank result. I can search for previous records before i opened the applications. Its as though the database opens a cached copy, and you can only insert into it.

Here is my current code. Has anybody else had similar issues.

private void button2_Click(object sender, EventArgs e)
{
    if (txtAddRegistration.Text != "")
    {
        if (comboAircraft.Text != "")
        {
            if (comboAirline.Text != "")
            {
                if (comboLocation.Text != "")
                {
                    int picyesorno;
                    string picloc;
                    if (txtAddPicLoc.Text == "")
                    {
                        picyesorno = 0;
                        picloc = "";
                    }
                    else
                    {
                        picyesorno = 1;
                        picloc = txtAddPicLoc.Text;
                    }
                    string InsertRegCommand = "INSERT INTO SPOTTINGLOG (registration, aircraft, airline, location, date, pictured, picloc, comments) values('" + txtAddRegistration.Text + "','" + comboAircraft.Text + "','" + comboAirline.Text + "','" + comboLocation.Text + "'," + dateTimePicker1.Value.ToShortDateString() + "," + picyesorno + ",'" + picloc + "','" + txtAddComments.Text + "')";
                    string database = @"D:\Daniel\Documents\Visual Studio 2008\Projects\AviationSpottingLog\AviationSpottingLog\SpotData.sdf";
                    try
                    {
                        SqlCeConnection conn = new SqlCeConnection("Data Source=" + database);
                        conn.Open();
                        SqlCeCommand command = new SqlCeCommand();
                        command.Connection = conn;
                        command.CommandText = InsertRegCommand;
                        command.ExecuteNonQuery();
                        conn.Close();
                    }
                    catch
                    {

                    }
                    try
                    {
                        this.searchAfterAdd(txtAddRegistration.Text);
                    }
                    catch
                    {
                        MessageBox.Show("Search didnt work");
                    }
                    txtAddComments.Clear();
                    txtAddPicLoc.Clear();
                    txtAddRegistration.Clear();
                    comboAircraft.Text = "";
                    comboAirline.Text = "";
                    txtLabelAdded.Text = "Added";
                    AddStatus.Start();
                }
                else
                {
                    MessageBox.Show("You must enter a location.", "Insert Record", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("You must enter an airline.", "Insert Record", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        else
        {
            MessageBox.Show("You must enter an aircraft type.", "Insert Record", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
    }
    else
    {
        MessageBox.Show("You must enter a registration.", "Insert Record", MessageBoxButtons.OK, MessageBoxIcon.Error);
    }


}

private void searchAfterAdd(string param)
{
    this.spottingLogTableAdapter.Fill(this.spotSearchReg.SpottingLog, param);
}

private void btnSearch_Click(object sender, EventArgs e)
{
    if (txtSearchReg.Text != "")
    {
        this.spottingLogTableAdapter.Fill(this.spotSearchReg.SpottingLog, txtSearchReg.Text);
    }
    else
    {
        MessageBox.Show("Please enter a registration to search for.\n\nIf you would like to view records for specific Airports, Airlines and Aircraft, go to 'Browse Data Lists' on the top menu.", "Enter Search Criteria", MessageBoxButtons.OK, MessageBoxIcon.Error);

    }
}

QuestionClickOnce Update Problem Pin
MWRivera26-Aug-09 10:46
MWRivera26-Aug-09 10:46 
AnswerCross post Pin
Not Active26-Aug-09 10:58
mentorNot Active26-Aug-09 10:58 
QuestionUdpClient Error : Only one usage of each socket address (protocol/network address/port) is normally permitted PinPopular
zafersavas26-Aug-09 10:10
zafersavas26-Aug-09 10:10 
AnswerRe: UdpClient Error : Only one usage of each socket address (protocol/network address/port) is normally permitted Pin
stancrm26-Aug-09 13:05
stancrm26-Aug-09 13:05 
AnswerRe: UdpClient Error : Only one usage of each socket address (protocol/network address/port) is normally permitted Pin
N a v a n e e t h26-Aug-09 15:47
N a v a n e e t h26-Aug-09 15:47 
QuestionSpecial character ` in Visual Studio generated queries and how to remove it Pin
prg191226-Aug-09 9:58
prg191226-Aug-09 9:58 
AnswerRe: Special character ` in Visual Studio generated queries and how to remove it Pin
N a v a n e e t h26-Aug-09 15:49
N a v a n e e t h26-Aug-09 15:49 
GeneralRe: Special character ` in Visual Studio generated queries and how to remove it Pin
prg191227-Aug-09 11:15
prg191227-Aug-09 11:15 
QuestionC# Messenger Pin
I Believe In GOD26-Aug-09 9:51
I Believe In GOD26-Aug-09 9:51 
AnswerRe: C# Messenger Pin
DaveyM6926-Aug-09 10:11
professionalDaveyM6926-Aug-09 10:11 
GeneralRe: C# Messenger Pin
I Believe In GOD26-Aug-09 12:13
I Believe In GOD26-Aug-09 12:13 
GeneralRe: C# Messenger Pin
harold aptroot26-Aug-09 10:22
harold aptroot26-Aug-09 10:22 
GeneralRe: C# Messenger Pin
I Believe In GOD26-Aug-09 12:17
I Believe In GOD26-Aug-09 12:17 
GeneralRe: C# Messenger Pin
harold aptroot26-Aug-09 12:47
harold aptroot26-Aug-09 12:47 
AnswerRe: C# Messenger Pin
Patrick Eckler26-Aug-09 12:03
Patrick Eckler26-Aug-09 12:03 
GeneralRe: C# Messenger Pin
harold aptroot26-Aug-09 12:10
harold aptroot26-Aug-09 12:10 
AnswerRe: C# Messenger Pin
N a v a n e e t h26-Aug-09 16:02
N a v a n e e t h26-Aug-09 16:02 

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.