finito 46 Nearly a Posting Virtuoso

Try Running this separately

SELECT DISTINCT c.primaryemailaddress, c.companyname, CAST(m.maxdate AS DATETIME ) AS maxDateCreated
FROM companycontact AS c

Then try this separately.

SELECT so.companyname, MAX(so.date_created) AS maxdate
FROM ordhed_sales AS so, company AS co
WHERE so.companyname = co.companyname
AND co.isOEM = '1'
GROUP BY so.companyname) AS m

Peace.

finito 46 Nearly a Posting Virtuoso

Hmm,

Look into Database.

If you are just practicing it may be a good idea to play with MS Access, If you don't mind getting right into it look into SQL.

Here Read these

Database.

SQL. This is a good beginners guide.

Just read these and tell me what you think.

Present your Questions and Theories.

Peace.

finito 46 Nearly a Posting Virtuoso

Please Look at this.

then Look at this.

Read them and see what you figure out.

Ask Questions and present your theories.

Peace.

finito 46 Nearly a Posting Virtuoso

Post some more of your code.

Provide the data types of the variables.

Don't use Help as a subject Matter.

Peace.

finito 46 Nearly a Posting Virtuoso

Try this

// Getting Max RecordNo
string maxRec = getMaxRec("12/05/0003");

which will be followed by

//WHERE LNo is your current Loading Number.
private static string getMaxRec(string LNo)
{
    string MaxRec;
    try
    {                                                           
         MaxRec =  new OleDbCommand("Select Max(RecNo) + 1 From LoadItems where LoadingNo="+LNo, con).ExecuteScaler();
    }
    catch { MaxRec = 1; }

    return MaxRec;
}

The try catch is for the very first entry.

When it tries to fetch the MaxRecNo for the very first entry of the day where RecNo should be 1 it will get nothing and throw an exception where you catch it and set it to 1.

I didn't try the solution so there maybe some punctuation I may have missed please check it.

This code also Assumes you have LNo already set for the day.

I still don't completely understand your code, but I understand the concept.

I assume you are trying to say that one LoadingNo (LNo) has many RecNo. So RecNo is really the count of different Pallets or Items that go into the Lorry but why not keep it the Product/Serial No of the Pallet/Item?

It may be a better idea for you to go with Mitja Bonca advice as it will be a lot simpler to work with in the future.

Peace.

finito 46 Nearly a Posting Virtuoso

CalculateNewRecordNumber
You still didn't clarify what this is?

Try this for the textBox

textBox2.Text = DateTime.Now.ToString("dd/MM/yy", DateTimeFormatInfo.InvariantInfo);

I still don't understand what you are doing here.

string strChechID1 = "select LoadingNo from LoadItems where LoadingNo=LoadingNo";

Please provide the Create Table statement for this table and provide a sample Input/Output.

-------
EDIT
-------

Ok I understand what loadingNo is now, But then what is the point of RecNo.

i.e. if LoadingNo is 12/05/0003 is the third Invoice or Loading that happened that day. When what is Rec?

Won't Rec be 3 as well?

------------------------

Peace

finito 46 Nearly a Posting Virtuoso

basically can u tell me the code to replace some strings in the rich text box i.e clearing and inserting

//Clearing
richTextBox1.Clear();


//Inserting 
richTextBox1.Text="ABCD\nEFGH";

// Adding /n is to generate a new Line so Output will be
// ABCD
// EFGH

Peace.

finito 46 Nearly a Posting Virtuoso

Could you explain what CalculateNewRecordNumber is supposed to do.

I think it can be done more efficiently.


Why are you doing this?

textBox2.Text = DateTime.Now.ToString(strFormat);

textBox2.Text = record;

This statement doesn't look right

string strChechID1 = "select LoadingNo from LoadItems where LoadingNo=LoadingNo";

Ok this is Where you say the problem is.

int RecNo = 1;

if (dtrCheckID1.HasRows)
{

	RecNo += 1;



	comm.Parameters.AddWithValue("@LoadingNo", textBox2.Text);
	comm.Parameters.AddWithValue("@RecNo", RecNo);
	comm.Parameters.AddWithValue("@PONo", PONO);
	comm.Parameters.AddWithValue("@Cust", Customer);
	comm.Parameters.AddWithValue("@Item", Item);
	comm.Parameters.AddWithValue("@Model", Model);
	comm.Parameters.AddWithValue("@Material", FGrade);
	comm.Parameters.AddWithValue("@Thk", Thk);
	comm.Parameters.AddWithValue("@Width", Width);
	comm.Parameters.AddWithValue("@Length", Length);
	comm.Parameters.AddWithValue("@Qty", Qty);
	comm.Parameters.AddWithValue("@Remark", Remark);


	comm.ExecuteNonQuery();
	lblMessage.Text = ("Successful Insert!!!");
	con.Close();

	timer1.Enabled = true;
}


else
{
	comm.Parameters.AddWithValue("@LoadingNo", textBox2.Text);
	comm.Parameters.AddWithValue("@RecNo", RecNo);
	comm.Parameters.AddWithValue("@PONo", PONO);
	comm.Parameters.AddWithValue("@Cust", Customer);
	comm.Parameters.AddWithValue("@Item", Item);
	comm.Parameters.AddWithValue("@Model", Model);
	comm.Parameters.AddWithValue("@Material", FGrade);
	comm.Parameters.AddWithValue("@Thk", Thk);
	comm.Parameters.AddWithValue("@Width", Width);
	comm.Parameters.AddWithValue("@Length", Length);
	comm.Parameters.AddWithValue("@Qty", Qty);
	comm.Parameters.AddWithValue("@Remark", Remark);


	comm.ExecuteNonQuery();
	lblMessage.Text = ("Successful Insert!!!");
	con.Close();

}

All I see is one statement has RecNo += 1; and the other doesn't.

Could you please clarify what exactly you want, also coding your code would immensely help.

Peace.

finito 46 Nearly a Posting Virtuoso

resolved

Please Mark as Solved.

Peace.

finito 46 Nearly a Posting Virtuoso

I think you are asking about the Raw DateTime format as you receive from it from the Database.

This varies on the database itself.

MSSQL spits it out like this: yyyyMMdd HH:mm:sss:hhh

MySQL I believe is yyyyMMddHHmmss

If you mean how to you Enter Date into a DateTime variable

Then you need to use ParseExact.

Peace.

finito 46 Nearly a Posting Virtuoso

You can also use CAST Command

CAST(fieldname as VARCHAR[50])

But this is more useful in using the field as a temporary basis. Like

SELECT CAST(fieldname as VARCHAR[50]) from table_name

For Permanent change using the above solution is better. (ALTER TABLE)

Peace.

debasisdas commented: wrong answer. -3
finito 46 Nearly a Posting Virtuoso

Can you enter BIOS by pressing F2 or Del it should say how to enter BIOS on the bottom of the screen.

Go in and see if you can "Load Bios Defaults".

BIOS menus are always different you will have to refer your manual.

What happens if you leave the machine on for like 10 minutes on the Blank Screen?

Are you comfortable in Removing your hard drive to document and report the effect?

It may be a simple case of malware simply fixed by Reinstalling the OS (you may loose data).

Peace.

finito 46 Nearly a Posting Virtuoso

Look at this part alone:

SELECT 'ClientDocs', ClientID FROM clients WHERE NOT (clients_ClientID IN (SELECT ClientID FROM clients,folders WHERE clients.ClientID=folders.clients_ClientID))

In your first post you said:

Client Table: ClientID INT PK AI, ClientName VarChar

Look at this part:

WHERE NOT (clients_ClientID IN

You are calling for clients_ClientID from the Client Table Where you have said that client_ClientID is from the Folders Table.

finito 46 Nearly a Posting Virtuoso

After trying to figure this out I have found a solution.

If you want to follow how i concluded the solution it's here.

If you just want the solution.

Find your my.cnf file on your Linux Server.

Usually in /etc/my.cnf

in Ubuntu based distribution it's in /etc/mysql/my.cnf

Scroll Down to the [mysqld] section

add the following line

skip-name-resolve

This is the Updated Code for MySql 5.0+

Peace.

finito 46 Nearly a Posting Virtuoso

I am having some trouble.

I have a Linux Server hosting 5.1 MySql.

The Windows clients are running a POS Program written in C# using the .Net Connector.

The Problem is that the initial connection takes around 12 Seconds which is not a big problem, but when you let it idle for a couple of minutes it seems to close the connection and requires another 12 seconds to reconnect.

Once connected it works fine and is very snappy.

I read on a few posts it could be a NETBIOS issue but that is an ODBC driver issue and it seems to be solved.

Is anyone else facing this issue?

finito 46 Nearly a Posting Virtuoso

Please read the rules, No thread Hijacking.

As for your problem, check the GPU fan, it maybe stuck. if there is no Fan, check the heatsink.

finito 46 Nearly a Posting Virtuoso

Ask for a refund. No use trying to keep fixing a month old machine. You will keep facing problems.

finito 46 Nearly a Posting Virtuoso

it is quite possible, but it depends on how many bad sectors we are talking about.

It could also mean that the source is corrupt.

finito 46 Nearly a Posting Virtuoso

there is a small thin cable that goes from the Cd to the Motherboard for audio.

Have you set the Drive to cable select or Master /Slave? regardless try setting it to CS for both the hard drive and Cd-Rom

finito 46 Nearly a Posting Virtuoso

I would suggest you start small, gain experience and then goto the bigger stuff.

Fro starting I think you should play with MS Sql Express. There are a lot of tutorials and samples online for this setup.

As for Visual Studio, don't you want to plant your feet in the ground before you go around spending money?

finito 46 Nearly a Posting Virtuoso

if you goto Menu (where it usually says start in Windows) there is a little search bar on the botton in there type 'Disk Utility' It will show you all the drives on the computer from there click on your drive.

On the right Panel it will show you information on the drive. If Smart is enabled it will give you a light indicator of how your drive is doing.

You want to look for Smart Status for the indicator and right underneath it Click on Smart data for more information, like how long the drive is running, How many bad sectors, etc.

finito 46 Nearly a Posting Virtuoso

Ok just to make sure your Wave is turned up.

If it is already up, please let me know.

finito 46 Nearly a Posting Virtuoso

So does your machine boot now or no?

By boot I mean you hear the Post beep. It's a single beep after you switch it on it comes up within a few seconds of switching the machine on.

If it boots, do you see the Dell logo in the beginning? or just "a white mark like a curser point on the screen"?

If you don't get the Dell logo, then your LCD or VGA maybe damaged, if you get the Dell logo then your drivers maybe corrupt.

finito 46 Nearly a Posting Virtuoso

Maybe a faulty cable?

Try changing the cable.

finito 46 Nearly a Posting Virtuoso

It sounds like malware.

Read this thread

Then post your query here

You may have to go into safe mode.

finito 46 Nearly a Posting Virtuoso

Best DB?

That is a debate in it's self.

The Simple answer is it depends, what do you want to do?

Just learn? maybe Access or MS SQL Express.

To Deploy? again depends what sort of scale?

You have to provide more information on what you want to do.

finito 46 Nearly a Posting Virtuoso

Which line are you getting this error?

DataRow dr = dt.Rows[0]; // ???

did you try to generate your stored procedure in the SQL Browser? Do they all give you a result?

finito 46 Nearly a Posting Virtuoso

Silly me I just noticed you are a spammer..

finito 46 Nearly a Posting Virtuoso

Well, Honestly XP was the Last Version that I would ever use, but you must understand that using XP is dangerous as Security Vulnerabilities put you on risk of infection or hacking.

I faced this same dilemma at the Launch of Vista, after trying it out I formatted my machine and Broke the CD, so much hate for Vista. Windows 7 maybe faster but I haven't seen that, it just too much bloat for me. Where XP is too dated.

Might I suggest Linux to you? Try it goto LinuxMint. Expect a small learning curve, but it's one of those things once you go there you will never wanna come back to Windows, the plus side is, It's free and Open Source.

You can Download, Burn, and Load it, with out installing it. Basically When you boot it will ask you if you want to to try it, select the first option which will be to try it. And it will take a few minutes as it loads itself on to the RAM, and then it will present to you a slower version of the full fledged OS as it is installed. It is slow because it is being run from the CD, it isn't installed. You get to test it and if you like it install it.

If you are worried about games, you should look into WINE, alot of Windows Games run on Linux through Wine. You can see your application compatibility …

finito 46 Nearly a Posting Virtuoso

Well depending on your call or Read Loop.

ListViewItem temp;
            while (Your Select Loop)
            {
                temp = new ListViewItem()
                temp.Text = ColumnData1
                temp.SubItems.Add(ColumnData2)
                temp.SubItems.Add(ColumnData3)
                '.....
                '.....
                temp.SubItems.Add(ColumnData8)
                temp.SubItems.Add(ColumnData9)
                listView1.Items.Add(temp) 'your ListView
            }

you don't have to use while, use your own propagation method.

Please mark as solved if solved or ask questions.