dickersonka 104 Veteran Poster

You need the user control to save its data, not sure what you need so can't give you any tips there yet. I don't know how they work, but you might be able to make them member variables on the form and never dispose of them.

My advice would be to set your area you want to display the user control in as a panel.
Upon clicking each menu item, you would have something like:

//Create control
//This might be a member variable instead
DeSched Deschedule = new DeSched();
//Clear controls
this.panel.Controls.Clear();
//Add control
this.panel.Controls.Add(Deschedule);
dickersonka 104 Veteran Poster

Create all that code as a class, then you will be able to share that code in between multiple pages.

dickersonka 104 Veteran Poster

You really can't do this from the fileupload control. Based on certan ie permission settings, it won't always work in ie either.
My advice is to use either your own control and load the textbox value on postback, or use a 3rd party control.

You normally don't need, care, and so on....of what the path was on the client side.
You might want to rethink the way you are doing things if you need the client path.

dickersonka 104 Veteran Poster

Do you have the source you can show us where you are assigning the buttons?
Make sure you are adding the action listener from both buttons. Also assuming those two objects are buttons.

connect.addActionListener(this);
disconnect.addActionListener(this);
dickersonka 104 Veteran Poster

As previously stated before it could be a lot of things. The schema doesn't look like it should take anytime to query regardless if indexes are in place or not.

When you are in this 10 min waiting phase, run this command on the database, just in management studio is fine.

sp_who2

My guess, is that something is locking up these records. Might not be, but for just a basic table with a small recordset, something extraordinary is going on.

The thing to look at is the BlkBy column. Please report back your results

dickersonka 104 Veteran Poster

For one your command is named the same as your connection.

Make it like this and try to run it, then let me know what errors you are getting

SqlCeCommand command = new SqlCeCommand("INSERT INTO tblCustomers (Customer_Ref, Customer_Name) VALUE(@Customer_Ref, @Customer_Name)");
dickersonka 104 Veteran Poster

Lots of moving pieces here. This most likely makes me think its a permission issue connecting to the database, but might not be.
Can you make sure your connection string is connecting as a single user to the database with the same host, regardless of the logging in user?
Any mysql errors or exceptions you are getting, other than user name not found?

dickersonka 104 Veteran Poster

Where are you setting the connection to the command? My advice is to not set the connection open on the form shown. Only use the connection when you are going to run a sqlcommand / query. That way, when you are done with it you can close it.

dickersonka 104 Veteran Poster

you can import the data, in management studio right click on your destination database and click import, then set up a mysql connection to your other database

depending upon how mysql specific the queries are, they could most likely be used as well, just swapping out the connection strings

dickersonka 104 Veteran Poster

i think you are concerning yourself with the id's when you actually don't need them here, you know the order already

page 1
select * from table
limit 1 offset 0

page 2
select * from table
limit 1 offset 1

if you are doing ordering, just add the order by, and it will work the same

dickersonka 104 Veteran Poster

You have to show us what you got before we can help you

dickersonka 104 Veteran Poster

you need to have an open connection, just as it says, right before you call execute reader call this

if (conn1.State != ConnectionState.Open)        
{            
conn1.Open();        
}

also it would be a good idea to create a separate class or method for calling all sql functions, that way you don't have to worry about closing and opening except in a single place

dickersonka 104 Veteran Poster

A common question that routinely comes up is how to share data between forms.

I have outlined two common ways to pass data between forms, among many others. I have used a public property on the output form to accept a value and update the display. I also have a method accepting parameters from the input form, to update the display.

On the first form there are three textboxes tbFirstName, tbLastName, and tbSample with a Submit button to redirect to the output form. I have the same layout on the output form to display the passed values.

dickersonka 104 Veteran Poster

ahhh, so for every record that exists in acts you are needing an update

my advice would be to use a sql 'for each' loop, you can use a cursor and iterate through each row and execute the update statement in there

dickersonka 104 Veteran Poster

If I add a distinct clause to the statement, only 9 records are returned from the budget table.

are you sure you are needing to do 34 updates, 9 records only need 9 updates

if the update isn't working properly, can you give us a little more of the schema and also what the distinct column is?

dickersonka 104 Veteran Poster

whether it is buttons or textboxes, still the same concept

//form 1
frmKeypad frmKey = new frmKeypad();
frmKey.ShowDialog();
this.btnQuestion.Text = frmKey.SelectedKey;


//form 2
private string selectedKey;
public string SelectedKey
{
get{ return selectedKey; }
}

//sample with just one button
 private void btnOne_Click(object sender, EventArgs e)
{
this.selectedKey = "1";
}

you can get creative with this and use a more generic method of doing this, but those are the basics

dickersonka 104 Veteran Poster

here's a link on a small little sample i did for that

http://alleratech.com/blog/post/Sharing-data-between-forms-with-C.aspx

dickersonka 104 Veteran Poster

could be done without it, i think you would have to parse and eliminate the extra escape characters then convert it to a byte array using encoding getbytes

i might be wrong, but just a shot

dickersonka 104 Veteran Poster
dickersonka 104 Veteran Poster

think this is what postgre calls bytea

check out this
http://docs.huihoo.com/enterprisedb/8.1/dotnet-usingbytea.html

25.15.1. Retrieving the BYTEA Column Using .NET Code

hopefully that can be a good start

dickersonka 104 Veteran Poster

pretty much the same thing

the important piece being this line

Application.ThreadException += new System.Threading.ThreadExceptionEventHandler (Application_ThreadException);

unless you want to use it to catch exceptions that you didn't handle already, its not a recommended solution for error handling

dickersonka 104 Veteran Poster

Not really

Its good practice to handle the exceptions as they occur and decide if you can move on or pass back a specific error message

Here is an example of what you might be looking for though
http://stackoverflow.com/questions/337702/c-how-to-implement-one-catchem-all-exception-handler-with-resume

dickersonka 104 Veteran Poster

you are trying to run the jar file

do you have this in there?

public static void main(String [] args)

i'm assuming you don't, but for a jar file to be run, just like any other code, it needs to start with a main method

dickersonka 104 Veteran Poster

i should add to this, both really have their place

normally you would use these instance methods when they pertain to particular class, lets says a single point of reference for a connection string inside a configuration class

and for the static variables without instance you could use as formatting a string to remove all spaces

i sort of like to put them in the terms of Utility (static) vs Instance (Non utility)

dickersonka 104 Veteran Poster

when using this

public static int Result4, Result6 = 0;
 public static Assembly DMUAssembly;

there is no need for a singleton, they are static variables


when using this

public class GlobalVariables
    {
        private static readonly GlobalVariables TheSingleGlobalVariableInstance = new GlobalVariables();

        private GlobalVariables()
        {
                result6 = 5;
        }
           
        public static GlobalVariables  Instance
        {
get
{
            return TheSingleGlobalVariableInstance;
}
        }

private int result6;
 public int Result6
{
   get{ return result6; }
}

you have to access the variables through the instance of that class

also notice i took away the set public method in there, that allows these properties to be readonly from outside that class

depending upon the need, you may or may not want to do it that way

dickersonka 104 Veteran Poster

The problem with that would be is that its not a singleton and can exist in multiple classes

private static readonly GlobalVariables TheSingleGlobalVariableInstance = new GlobalVariables();

        private GlobalVariables()
        {
        }
           
        public static GlobalVariables  Instance
        {
get
{
            return TheSingleGlobalVariableInstance;
}
        }

The above piece allows only a single instance to exist in the application, which can be called by any class without creating an instance of it

//you can do this
GlobalVariables.Instance.Result6 = 5;

//you can't do this
GlobalVariables gv = new GlobalVariables();
gv.Result6 = 5;

you normally would use this singleton method for a configuration accessor class or a group of data that needs to be shared throught the app without passing a class object around

ddanbe commented: good explanation +4
dickersonka 104 Veteran Poster

i only saw part of the output, what format is this output in?

dickersonka 104 Veteran Poster

you are mixing static with singleton here

try this way

public class GlobalVariables
    {
        private static readonly GlobalVariables TheSingleGlobalVariableInstance = new GlobalVariables();

        private GlobalVariables()
        {
        }
           
        public static GlobalVariables  Instance
        {
get
{
            return TheSingleGlobalVariableInstance;
}
        }

private int result6;
 public int Result6
{
   get{ return result6; }
   set {result6 = value; }
}

and from your other code, you can call it like this

Console.WriteLine("This is the DMUServer : {0}", GlobalVariables.Instance.Result6);
dickersonka 104 Veteran Poster

are you meaning all your double backslashes?

just run a replace on your escaped characters

Dim fileAsString As String = myString.Replace("\\", "\")

i think this is how with vb, more familiar with csharp

dickersonka 104 Veteran Poster

try this

its unclear why you are using string text as a parameter if its not being passed on, but here it is

void delegate textCallback(string text);
public void ThreadProcSafe2(String text)
        {
            if (this.m_AllKnownDevicesFrm.InvokeRequired)
            {
                this.m_AllKnownDevicesFrm.Invoke(new textCallback(ThreadProcSafe2), text);                
            }
            else
            {
                switchPanels(1);
            }
        }
dickersonka 104 Veteran Poster

the management tool you need for the import is just sql management studio or even run it through code
did you try the bulk insert?

escape format meaning?

dickersonka 104 Veteran Poster

opening it up wouldn't do anything, as long as you don't save it

have you tried to import inside management studio specifying the pipe, or doing something like this?

BULK INSERT MyTableName
    FROM 'c:\mydata.psv' 
    WITH 
    ( 
        FIELDTERMINATOR = '|', 
        ROWTERMINATOR = '\n' 
    )
dickersonka 104 Veteran Poster

add an extra variable called shown

private bool shown = false;
private void button1_Click(object sender, EventArgs e)        
{            
firstName = "Tom";            
lastName = "Lee";            
popup();        
}         

private void button2_Click(object sender, EventArgs e)        
{           
 firstName = "Peter";            
lastName = "Green";            
popup();        
}       

 void popup() 
{            
if(!shown)
{
   shown = true;
   Thread th = new Thread(FindContactEmailByName);            
   th.Start();        
}
}

and when the form closes for the contact, don't see your code here, just mark shown = false;

dickersonka 104 Veteran Poster

why can't you just do an import into sql server without going code side?

also are you sure you mean a psv or csv?

dickersonka 104 Veteran Poster

its because you are using an untyped list for one, but you didn't have an else statement

if (yourValue == "b")
{
break;
}
else
{
numbers.Add(Convert.ToInt32(yourValue));
}

also you could use List instead of ArrayList

List<int> numbers = new List<int>();
dickersonka 104 Veteran Poster

Prices.Add(2.0);

This only appends to your list, this does not so called 'add' or sum them together

for the sum you need to use a foreach or enumerator as you had before, and increment sumValue

dickersonka 104 Veteran Poster

there are other ways you could do this, but here's one

select
CAST(Reference AS INT) as REFERENCE
from tablename
dickersonka 104 Veteran Poster

i'm not sure what you are meaning

the actual value? of what?
and what are you wanting to use for testing?

dickersonka 104 Veteran Poster

you can compile c from command line, just use the same from c#
the redirectstandardoutput will allow you to get the output that would be displayed as well

Process proc = new Process();
proc.StartInfo.FileName = "compiler name";
proc.StartInfo.RedirectStandardOutput = true;
proc.Start();

string output = proc.StandardOutput.ReadToEnd();
dickersonka 104 Veteran Poster

you don't always have to use that way, but you can

you could also do something like this

foreach(int num in numbers)
{
  Console.WriteLine(" " + num);
}
dickersonka 104 Veteran Poster

this here in your file, shows that it is supposed to be a jpeg
\\377\\330\\377\\340

here's a c# sample to check a stream
http://stackoverflow.com/questions/210650/validate-image-from-file-in-c

dickersonka 104 Veteran Poster

this will loop through all the values in your array
IEnumerator basically means you can use it to iterate your data

lets say you have 1, 5, 3, 8 in your array

this will print out

1 5 3 8

dickersonka 104 Veteran Poster

try to save the byte array to a file rather than image first, and see if you can open that file up properly

'Get our byte array
obj = StringToByteArray(ImageString)

'Save to a file
Dim oFileStream As System.IO.FileStream
 oFileStream = New System.IO.FileStream("image.jpg", System.IO.FileMode.Create)
 oFileStream.Write(obj, 0, obj.Length)
oFileStream.Close()
dickersonka 104 Veteran Poster

What is the result of the show full columns statement i sent you, if its latin1_bin thats why

dickersonka 104 Veteran Poster

try this then, c# but i'm sure you can convert it to vb

ImageConverter imageConverter = new System.Drawing.ImageConverter();
Image image = imageConverter.ConvertFrom(obj) as Image;

if that doesn't work, i'm wondering if its an encoding issue

try swapping out your string to byte array with this

Public Shared Function StringToByteArray(intput As String) As Byte()
   Dim encoding As New System.Text.ASCIIEncoding()
   Return encoding.GetBytes(input)
End Function
dickersonka 104 Veteran Poster

try specifying the size of the memory stream, are you also sure stringtobytearray is doing what it should?

Dim ms As New MemoryStream(obj, 0, obj.Length)
dickersonka 104 Veteran Poster

I would suggest you to take a shot at it and say what tables and columns you have for now, as far as normalization goes

I have done a similar design recently for basketball, here is the basic concept

lowercase - tables
uppercase - columns


teams
TEAM_ID
TEAM_NAME
DISTRICT_ID

district
DISTRICT_ID
DISTRICT_NAME

game
GAME_ID
HOME_TEAM_ID
HOME_TEAM_SCORE
AWAY_TEAM_ID
AWAY_TEAM_SCORE
GAME_DATE
GAME_TIME

if you want to expand this out to players and scores, i would suggest something like this

players
PLAYER_ID
TEAM_ID
PLAYER_NAME

gameplayers
GAME_PLAYER_ID
GAME_ID
TEAM_ID (the reason for this, is because if a player has been traded, it still shows the team they played for in the game)
PLAYER_ID

gamescorers
GAME_SCORER_ID
GAME_PLAYER_ID
SCORE_TIME

dickersonka 104 Veteran Poster

you could also use varchar(max)

here's a link that will explain it
http://www.teratrax.com/articles/varchar_max.html

and also a reference for it (check out #2)
http://www.sql-server-helper.com/faq/sql-server-2005-varchar-max-p01.aspx

dickersonka 104 Veteran Poster

also try this statement also

select * FROM assign2 WHERE UPPER(CONVERT(keyword1 USING latin1)) LIKE '%MICROSOFT%';
dickersonka 104 Veteran Poster

you should be able to use a nvarchar(max)