G_Waddell 131 Posting Whiz in Training

Glad I could help - I think...

G_Waddell 131 Posting Whiz in Training

MSDN Multiply in SQL

Exactly as you have done there (providing both values are numeric data types,) just to be sure in case you get NULL values I would use the ISNULL function to return a zero if there is a NULL:

SELECT ISNULL(quantity,0) * ISNULL(rate, 0) as VALUE FROM 
G_Waddell 131 Posting Whiz in Training

Hi,

Have you tried the TextSharp website?

G_Waddell 131 Posting Whiz in Training

Hi Xerohomicide,

Doesn't the .Tostring("d"), (short date) depend on your system locale settings?

G_Waddell 131 Posting Whiz in Training

Hi,
Just a note on using Mod, 0 Mod (any number) = 0 so you should also check your input is greater than 0 (unless of course, zero is an acceptable input)

G_Waddell 131 Posting Whiz in Training

hi,

Just to explain why you had results that appeared odd. Your month and Year columns were both varchar type when you sort these types, it will by default, sort the columns alphabetically... i.e April, August, December etc.
not January, February, March, April, May, June, July etc.

So if you put in a query that where month >= April and Month <=December I would only get records for April, August and December not April, May, June, July, August, September, October, November and December as it varchar will sort alphabetically.

As the others have said, you are better to use a date field this way you can sort by date

G_Waddell 131 Posting Whiz in Training

Hi,

Have you defined an Insert command for the Adaptor? Have you checked the syntax of the command by running it in your database?

G_Waddell 131 Posting Whiz in Training

No worries remember to mark as solved!

G_Waddell 131 Posting Whiz in Training

Hi ,

Have you tried setting integrated security to false and supplying a blank password and username value in your connection?

G_Waddell 131 Posting Whiz in Training

Hi
Have you tried running the update statement directly inside your database?
Also, that statement is not being dynamically changed ie. you are always setting the equipage field to Skipper on the record(s) where the Num field = 10

G_Waddell 131 Posting Whiz in Training

Ok so with your project open make a change. Then look up that record in the database, has the change carried through?

G_Waddell 131 Posting Whiz in Training

Hi,

Your SELECT statement that is run in the command is only selecting quantity and rate so the datareader will only have quantity and rate fields.

G_Waddell 131 Posting Whiz in Training

Hi,
Try debug with break points and step through it, paying particular attention to the connection string values. Also, check your access Database isn't open elsewhere or locked - This could prevent the update from happening

G_Waddell 131 Posting Whiz in Training

A 2005 SEAT Cordoba 1.4 TDi Sport, which will probably confuse people outside of Europe who have either never heard of SEAT or who wonder how a car with an 80 bhp, 3 cylinder, 1.4 litre diesel engine can drive at a 100 - 120KPH on my daily commute of 100 KM and fit four people. In terms of fuel efficiency, I laugh at you 3.8 L/100Km on the highway and 6.1L/100km around town in other words I do 30-40mpg in town and 60 -70 mpg on the open road all on lovely cheap diesel

G_Waddell 131 Posting Whiz in Training

Trevino,
You should really post your question under it's own discussion.

Anyway, you should look at the System.IO Namespace This will help you with writing to files and reading from them.

G_Waddell 131 Posting Whiz in Training

Hi,
It may be cheating to use another forum but it looks like the person was controlling volume levels Here

G_Waddell 131 Posting Whiz in Training

Hi,
If you can't sort the table directly, you should be able to make a DataView which you should then be able to sort.

G_Waddell 131 Posting Whiz in Training

Hi,

I think you can get the current users desktop from the environment.specialfolders there is a .desktop (for the desktop virtual,) and a .desktopdirectory for the physical file directory.

Reverend Jim commented: Right. I forgot about that. +12
G_Waddell 131 Posting Whiz in Training

I also see you've been banned - Quelle Surprise!

G_Waddell 131 Posting Whiz in Training

Irony is your quoting a line of text that says "Insults are not welcome" and then you insult me...
"At no point was the colour of your skin, your ethnicity or nationality mentioned what was pointed out was that as you were in a part of the USA which is a predominately English speaking" "are you really that dumb or you were born that way." Please oh font of wisdom, enlighten me as to what part of that statement was dumb?

The fact of the matter is my 6 year old son has better writing skills than you!

G_Waddell 131 Posting Whiz in Training

As daniel955 says, you should watch that capitalisation, "mm" is actually minutes in VB.NET as in "hh:mm:ss" e.g. "28/10/2013 11:30:44" is "dd/MM/yyyy hh:mm:ss" but if you had converted this date to "dd/mm/yyyy" you would get this string "28/30/2013" (28th day, 30 minutes, year 2013)

G_Waddell 131 Posting Whiz in Training

Hi,

I'd recommend using the express versions as well, - In the full version I can do all my programming for desktop and web sites and I use this as work as the company pay for it. At home, I have Visual Studio Express for Windows Desktop and Visual Studio Express for Web etc all for free Visual Studio 2013 Express for the latest 2013 versions

G_Waddell 131 Posting Whiz in Training

Hi,
You now have several choices on how to get data from the database:
You can use a DataAdapter to fill a DataSet Which is an in memory collection of Datatables, (think of it as an in memory database snap shot,) See DataSets, DataTables, DataViews Or if you want to just carry out a read ofsome data results a la recordset then you can use a DataReader

G_Waddell 131 Posting Whiz in Training

Hi,

If you used a DataAdaptor to supply the datasource, you can specify the Insert Update and Delete Commands then apply the Update method to push the changes over to the database. DataAdaptor Updates To add a new row to your DataGridView you can either pass the "default" values in as an array:

dim DGVRow as New DataGridViewRow (Cell1value, Cell2value, .... LastCellValue)

MyDataGridView.Rows.Add(DGVRow)

OR Clone an existing row already in the grid.

Dim DGVRow as DataGridViewRow 

DGVRow = MyDataGridView.Rows(0).Clone

MyDataGridView.Rows.Add(DGVRow)
G_Waddell 131 Posting Whiz in Training

For the save dialog part, there is a built in SaveFileDialog Class
This will enable you to put up an on screen Save File Dialog without having to design your own interface etc. (like we used to have to do in VB 6.0)

G_Waddell 131 Posting Whiz in Training

Recently taken up Judo (2-3 months) Going for my yellow belt in Early November.

I also attempt to play golf and have been for years...

G_Waddell 131 Posting Whiz in Training

Sorry,

I should mentioned at the bottom of the combobox column link I sent there is an example of adding one to a datagrid and populating it with values while linked to a Datasource.

G_Waddell 131 Posting Whiz in Training

Hi
The article link I gave you should cover using autocomplete.

This link is the MSDN site link to the ComboboxCell class

This is for the ComboBoxColumn Class

G_Waddell 131 Posting Whiz in Training

Sorry,

I based my answer on an example from some code I wrote not on your specifc code.

If you look at my code entries you will see that GetNoOfVisits is a function that takes in a userID and returns the number of visits from the database using a stored procedure with an output parameter. I should have also passed in a sql connection to the function - my bad!

I'm then feeding the result of this function into another parameter on another query.

G_Waddell 131 Posting Whiz in Training

I'd just also like to back Reverend Jim Up here - especially as I've just noticed you quoted back to him and put the word rasict underneath.

  1. I'll assume you mean racist.
  2. I would like to know how pulling you up on lazy typing and bad spelling is racist? At no point was the colour of your skin, your ethnicity or nationality mentioned what was pointed out was that as you were in a part of the USA which is a predominately English speaking (note I use the word predominately,) environment that you may take the time and effort to check what you are posting up and ensure it is readible.
  3. I have been a member of this forum for a number of years and have always found the Reverend Jim to be a helpful, knowledgable person and have seen no evidence of any racism in anyway from him.
  4. If you suffer from dyslexia or some other impediment to your typing / writing skills then fair enough, you can just say that but to attack someone who you don't know and who donates their time and expertise to moderate this forum for FREE because they pointed out you were sloppy is just unprofessional.
G_Waddell 131 Posting Whiz in Training

Ancient Dragon, Diafol - Why place under Software development? It is neither Software Development or Web Development specific - It should be on it's own....

deceptikon - I did state I may have asked this already...

pritaeas, deceptikon, Just because something was called a certain way in the past or "has always been done that way" doesn't mean we should not question it and not try and find better ways of doing something or else we would all be sitting punching paper cards into a mainframe the size of my house with the processing power of a desktop calculator - to start to progress we must question the norm.

G_Waddell 131 Posting Whiz in Training

Hi,

I may have asked this before but why are Databases not out on their own forum? Instead of under Web Development? It isn't just Web apps that use databases and the amount of How do I get records from <Insert Database Name Here>?, How do I create a stored procedure in <Insert Database Name Here>? How do I set up a new user account in <Insert Database Name Here>?, How do I query for <Insert Characterset Here> words in <Insert Database Name Here>? etc... type questions I see on other forums (VB.net, C#) makes me think it would be a good idea.

I know how we access them within our individual programming language is specific to the language but things like administration, SQL syntax, back ups etc would be specific to the database type and most people don't immediately think they would find that under Web Development.

Anyway Rant over! Keep up the good work!

G_Waddell 131 Posting Whiz in Training

Hi
If you go to the Web Development > Databases > MySql forum you may get someone who knows MySQL (Why Databases is under web development I don't get, it should be out on it's own category)

If it was Microsoft SQL server, I'd check that the collation I was using supported Greek characters, what the equivalent is in MySQL I don't know.

G_Waddell 131 Posting Whiz in Training

Hi
The Directory class in the System.IO namespace, should give you what you need. The problem is directories do not have sizes, it is the files stored in them that have sizes. However, it will enable you to bring back the sub directories and files i.e. if the folder has no sub directories and no files it is empty.

G_Waddell 131 Posting Whiz in Training

Oh nearly forgot you may have to set the autogeneratecolumns property to false to let you specify and work with the column types

G_Waddell 131 Posting Whiz in Training

Hi,

This Article is all about using the Autocomplete property in VB.NET. I'm not 100% sure about the normal DataGridViewTextBoxColumn but I do know the DataGridViewComboBoxColumn supports Autocomplete.

G_Waddell 131 Posting Whiz in Training

Hi,

Did you specify Update, Delete and InsertCommands for your DataAdapter?
InsertCommand

DeleteCommand

UpdateCommand

This will allow you to push your data changes back to the database. If you haven't what is actually happening is the data is being changed in the system memory (Dataset) but not on the actual database. Hence when you reload the data from the database, you do not have the changes as they were only in memory.

G_Waddell 131 Posting Whiz in Training

Hi,

The following code will trigger the garbage collector (that is actually what it is called) to "clean" the system memory of any disposed or redundant objects

System.GC.Collect()
System.GC.WaitForPendingFinalizers()
System.GC.Collect()

I usually use this if I'm doing a series of complex code inside a loop like this:

dim iCount as integer =0

For each Widget in MyWidgets
        iCount = iCount + 1
        If (iCount Mod 100 = 0) Then
            System.GC.Collect()
            System.GC.WaitForPendingFinalizers()
            System.GC.Collect()
        End If
'..... do loads of complex stuff and functions here on my "Widget" object
Next

This should free up some memory, other than that go through your code and see if you can be more efficient when it comes to memory use.

G_Waddell 131 Posting Whiz in Training

Hi
Does your Stored procedure use an Output Parameter? (Example below:)

CREATE PROCEDURE GETVISITCOUNT @UserID bigint, @NoVisits int OUTPUT 
AS
SELECT @NoVisits = COUNT(*) FROM Visits WHERE (UserID = @UserID)
...

Then in your code you would add the parameters but specify the NoVisits parameter is an output parameter:

Function GetNoOfVisits(byref UserID as integer, ByRef MyConn as SqlConnection) As integer
dim Visits as Integer = 0
Try
    'Set Up Command
    dim cmd as SqlCommand
    cmd.Connection = MyConn

    'You are executing a stored Procedure
    cmd.CommandType = CommandType.StoredProcedure

    'The Text will be the name of the Procedure
    cmd.CommandText = "GETVISITCOUNT"

    'Add Parameters
    cmd.Parameters.Add("@UserID", SqlDBType.BigInt)
    cmd.Parameters.Add("@NoVisits", SqlDBType.Int)

    'Specify Value of Input Parameter
    cmd.Parameters("@UserID").Value = UserID

    'Specify direction of output parameter (default is input)
    cmd.Parameters("@NoVisits").Direction = ParameterDirection.Output

    'Check Connection is open
    If MyConn.State <> ConnectionState.Open Then
        MyConn.Open() 'Open connection
    End if

    'Our output parameter will be populated with the data we need so no dataset required
    cmd.ExecuteNonQuery()

    Visits = cmd.Parameters("@NoVisits").Value

    return Visits
Catch 
    return 0
Finally
    cmd.dispose()

    if MyConn.State <> ConnectionState.Closed then
        MyConn.Close()
    end if

end try

You could then input this result into your next query as a parameter...

cmd2.Parameters.Add("@NoVisits", SqlDbType.Int)
cmd2.Parameters("@NoVisits").Value = GetNoOfVisits(MyUserID)
G_Waddell 131 Posting Whiz in Training

www.connectionstrings.com will show you how to connect to a mysql database (Or any other for that matter)

G_Waddell 131 Posting Whiz in Training

Hi,

It was the same version of .Net, but they were extra references I did have to include in the project (that I was not told about) once I added them it all started working

G_Waddell 131 Posting Whiz in Training

Greetings People of Daniweb!

I'm trying to add a 3rd party control to a form and I'm getting the following message:

**Unable to cast object of type 'Microsoft.Practices.EnterpriseLibrary.Data.Configuration.SyntheticConfigSettings' to type 'Microsoft.Practices.EnterpriseLibrary.Data.Configuration.ContainerModel.ITypeRegistrationsProvider' **

Does anyone have any idea why this could happen? Any searches I tried on google brings back nothing about Winforms but instead seams to be focused on Web Service Software Factory (WSSF,) and mentions differences in versions of EntLib.

I don't have any references to Entlib in my project, any ideas how I find what version I have? And do I need to add a reference in my Project?

G_Waddell 131 Posting Whiz in Training

HI,

Not sure you can customise each individual cell size, Height would be determined by the row's height and width by the Columns width I have a feeling Excel does this automatically - you could look at wrapping / not wrapping text

You should be able to set the individual cells format to handle the dates though

cell(row, col).NumberFormat ="yyyy-MM-dd" 

Should do it...

G_Waddell 131 Posting Whiz in Training

Hi,

Sorry again it's my lack of knowledge on Access syntax...These would work in SQL server

Basically DATEADD function adds a given date interval to a date. In this case I'm adding -1 Month to the current date (GETDATE is a SQL Server function to get the current Date) in otherwords, I'm getting last months date (remember if your in January the last month was the December before).

OK now to Mileage % 10000 =0 this is the equivalent of the VB Mileage Mod 10000 =0 in otherwords the modulus of mileage/ 10000 =0 i.e. the Mileage is an exact multiple of 10000. I just realised as I type this, I should also have put AND Mileage > 0 in as 0 divided by any number will always give zero.

So what you want is something like:

SELECT DISTINCT * FROM Vehicles  
WHERE (LastServiced = DATEADD(Month,-1, GETDATE())) 
OR
(Mileage % 10000 = 0 AND  Mileage > 0)

That will get all vehicles that were last serviced 1 month ago or that have a Mileage that is a multiple of 10,000

G_Waddell 131 Posting Whiz in Training

Hi,

You need to think about the two separate cases you have just outlined. You have to forgive me but I'm not 100% sure of Access syntax

Case 1 - one month or more since last serviced, the sql would be something like: WHERE (LastServiced <= DATEADD(Month, -1, GETDATE())

Case 2 - Mileage trigger, I'm not sure if you want a set of predefined triggers i.e. 20,000 30,000 40,000 etc or something like every 10000 miles : WHERE(Mileage IN (20000, 30000, 40000, 50000)) or WHERE(Mileage % 10000 = 0)

When you have settled on exactly what you want then you would combine them with an OR operator (You would also add a DISTINCT clause to the Query if you did not want a vehicle that satisfied both clauses appearing twice) e.g. :

SELECT DISTINCT * FROM Vehicles  
WHERE (LastServiced = DATEADD(Month,-1, GETDATE())) 
OR
(Mileage % 10000 = 0)
G_Waddell 131 Posting Whiz in Training

Just remember to use the override ToString function so that it displays correctly in the Combobox!

Begginnerdev commented: Mmm Love method overloading! +9
G_Waddell 131 Posting Whiz in Training

Hi,

You'd be better trying the MySQL forum, it is under Web Development > Databases > MySQL (Why it is under Web Development is a loss to me)

G_Waddell 131 Posting Whiz in Training

Hi,

Not being the person who wrote the code I cant be 100% sure BUT I can take an educated guess.

  1. The cpuLoad = 100- cpuLoad I think it could be that thePerformancecounter1.NextValue.ToString() could be giving you the available resource as a percentage so 100 minus this figure would be the amount used..

  2. cpuLoad.ToString() Probably because the value is being used to make up a string that will be the Label1 text. This isn't really needed in VB.NET as it will automatically be converted to a string but in other languages such as C# (maybe the original programmer copied and adapted C# code,) you must explicitly convert the Integer value to a String or it will throw an error. Some will also argue this is good programming practice especially if you will in the future be looking at using other languages too.

G_Waddell 131 Posting Whiz in Training

The SQL statement looks wrong ( not sure which database you are using)
select * from postoffice where date between '" & datefrom.Value & "' and '" & dateto.Value & "'"
try
select * from postoffice where date => '" & datefrom.Value & "' and date <='" & dateto.Value & "'"

G_Waddell 131 Posting Whiz in Training

HI the code where you set the style value is wrong...

  Public Property Style As Integer
16.        Get
17.            Return PointerStyle
18.        End Get
19.        Set(value As Integer)
20.            PointerStyle = Style
21.            Invalidate(Rect)
22.        End Set
23.    End Property

You want PointerStyle = value not PointerStyle = Style you are constantly resetting your style value to the initial value.