lolafuertes 145 Master Poster

A few questions:
What is the contents (value) of codimporter?
Exists some data in the DB where the cod_importer is equals to the value passed?
Do you get some error?
After the Dim cmdimp As New OleDb.OleDbCommand("select * from importer where cod_importer = " & codimporter.ToString & ";", conn), what are the next sentences you use to retrieve the data?

lolafuertes 145 Master Poster

I'll assume that codimporter is of type integer.

If this is true, then

Dim cmdimp As New OleDb.OleDbCommand("select * from importer where cod_importer = " & codimporter.ToString & ";", conn)

Else

Dim intCodeImporter as Integer = -1
Try
    intCodeImporter = Ctype(codimporter, Integer)
Catch ex as Exception
    msgbox "This is not an interger: " & codimporter
    '
    '  take any action when this is not an integer
    '
End try
Dim cmdimp As New OleDb.OleDbCommand("select * from importer where cod_importer = " & intCodeImporter.ToString & ";", conn)

Hope this helps

lolafuertes 145 Master Poster

For the second, the problem is related on how a date is mantained internally and the way is parsed. For a date of 04/03/2010 is this March 4th or April 3rd?
Instead of Now() use

Format(Now(),"yyyy-MM-dd")

This will present allways your date in the 'universal' format expected to be 2010-03-04 (March 4th, 2010)

Hope this helps

lolafuertes 145 Master Poster

You are using relative paths to gzip.exe and, depending on the starting folder of you application, this call can fail. Try to set the full path to gzip.exe .

Also be sure that the path Dest & "\Backup\" already exists.

Hope this helps.

lolafuertes 145 Master Poster

Jus guessing if the problem is in the task bar properties to hide the inactive icons.

Had you already tried to set it not to hide them?

lolafuertes 145 Master Poster

You are right, The GC 'must' clean the disposed objects using the dispose method or setting it to nothing but read http://msdn.microsoft.com/en-us/library/hks5e2k6(VS.80).aspx for more info on how the GC works.

If it is possible, limit the use of unnecessary 'duplicate' objects in memory.

IE: in the ValorParametro you can pass by reference an existing Datos.clsParametro() avoiding to set the .Conexion at each call.

Just curious, how and when do you release the result of AgregaLinea to the third party software? Do you create a new instance of it for each call to AgregaLinea?

Saludos.
Lola

lolafuertes 145 Master Poster

Try to not include the flash dlls into the distributable and set them as a requirement. When you install a fresh version of flash, the GAC is updated overriding your setting.

Verify if the VS has automatically created a wrapper for those dlls and include it in your project.

Hope this helps

lolafuertes 145 Master Poster

This means that a SQL Command was executed outside of a try catch structure and got an error.

lolafuertes 145 Master Poster
lolafuertes 145 Master Poster

Whe you say

but still its not working.

can you be so kind to specify wich are the simptoms?

lolafuertes 145 Master Poster

Use the windows task scheduler
http://support.microsoft.com/kb/308569/en-us for XP
http://windows.microsoft.com/en-US/windows-vista/Schedule-a-task for Vista
http://support.microsoft.com/kb/814596/en-us for Windows 2003
Also maybe you are interested on http://msdn.microsoft.com/en-us/library/aa383614(v=vs.85).aspx for the task scheduler API and http://msdn.microsoft.com/en-us/library/aa384006(v=vs.85).aspx showing examples about task scheduler API usage.

Hope this helps

lolafuertes 145 Master Poster

Please, on the thread http://www.daniweb.com/forums/thread276434.html see the answer from adatapost for an example on how to define the missing commands.

An yes, you need to specify wich datatable is to be updated so Msadptr.update(myTable) should be OK after you add the missing commands to you data adapter.

Hope this helps

lolafuertes 145 Master Poster

Msadaptr is the responsible for interact between the MyTable in memory and the phisical table 'user' in MySql.

Even you do not insert or update any thing in this procedure, is always a good programming practice to fill all the commands: SELECT, INSERT, UPDATE and DELETE. This way, the adapter will always work.

Your first code removes a row from the datagridview. I think is not necessary.

Your second code removes the row from the table in memory. To update the phisical table, you MUST call the Update method of the data adapter, and it will analyze wich records had been inserted, deleted or updated in the table to propagate those changes to the MySQL table.

IMO, lines 44 to 53 are not necessary. Because the data is already in memory is not necessary to re-fill the table and re-bind the data grid view. It is enough ro refresh the data grid view with dgvUsr2.Refresh().

Hope this helps.

lolafuertes 145 Master Poster

The starting object is a form?
If so, put breaks inside the Initialize Components and in the very first sentence on the form Load and Activate events to step through.

the starting object is a Sub
Put all the code of the sub inside a try /catch block. When the exception occurs, the stack trace can point you in the rigth direction.

Hope this helps

lolafuertes 145 Master Poster

On the ds you neew to add a new table

ds.Tables.Add("MyNewTable")

Then on ds.Tables("MyNewtable"), you need to add 5 columns

ds.Tables("MyNewtable").Columns.Add("Col1")
ds.Tables("MyNewtable").Columns.Add("Col2")
ds.Tables("MyNewtable").Columns.Add("Col3")
ds.Tables("MyNewtable").Columns.Add("Col4")
ds.Tables("MyNewtable").Columns.Add("Col5")

Then, you need to create a row to be added to the table

Dim MyNewRow As DataRow = ds.Tables("MyNewtable").NewRow

Here you must assign the values to the columns

MyNewRow.Item("Col1") = "A"
MyNewRow.Item("Col3") = "Book"
MyNewRow.Item("Col5") = "100"
MyNewRow.Item("Col2") = ds.Tables(0).Rows(I).Item(SourceItemIndex1)
MyNewRow.Item("Col3") = ds.Tables(0).Rows(I).Item(SourceItemIndex2)

After filling it you must add the row to the table

ds.Tables("MyNewtable").Rows.Add(MyNewRow)

Hope this helps

lolafuertes 145 Master Poster

Just a few comments.

Be sure to dr.close each data reader before closing the connection to the MySql database.

On the INSERT commnad I will change it to sime thing like:

strSQL = "INSERT INTO dbo.RetailerBalance([BoothID],[TransactionDateTime],[TransactionDate], [GrandTotal],) VALUES ('" & BoothID & "','" & Format(CurrentTranxDate,"yyyy-MM-dd") & "', " & (GrandTotal - (Dealer + Dealer1)).ToString.Replace(System.Globalization.CultureInfo.CurrentUICulture.NumberFormat.CurrencyDecimalSeparator,".") & ")"

Specially importannt to replace the decimal character by a point, that is the decimal separator accepted by MySQL. If the decimal separatos is the comma, it would be interpreted as a field separator.

Also interesting to format the date as universal format in order do avoit MySQL to decide if 11/07/2010 means July 11th, or Novembert 7th.

Hope this helps

lolafuertes 145 Master Poster
'
		'	Assuming the key pressed is stored in 
		'
		Dim KeyPressed As Keys
		'
		'	If there is any selecte row
		'
		If Dgview.SelectedRows.Count > 0 Then
			'
			'	Get it
			'
			Dim SelectedRow As DataGridViewRow = Dgview.SelectedRows(0)
			'
			'	And unselect
			'
			SelectedRow.Selected = False
			'
			'	Depending on the key pressed
			'
			If KeyPressed = Keys.Up Then
				'
				'	If up and the selected row is not the first
				'
				If SelectedRow.Index > 0 Then
					'
					'	Select the previous one
					'
					Dgview.Rows(SelectedRow.Index - 1).Selected = True
				End If
			ElseIf KeyPressed = Keys.Down Then
				'
				'	if down and and the selected row is not the last
				'
				If SelectedRow.Index < Dgview.Rows.Count - 1 Then
					'
					'	Select the next one
					'
					Dgview.Rows(SelectedRow.Index + 1).Selected = True
				End If
			End If
		End If

Hope this helps

lolafuertes 145 Master Poster
Dim WithEvents MyTimer as System.Timers.Timer ' to define the timer at module or class level
'
' inside de sub where you define when to fire the timer
'
Dim NumberOfSecondsToFiretheTimer As Double = 86400D ' One Day
MyTimer.Interval = NumberOfSecondsToFiretheTimer
MyTimer.Start

To catch the event

Private Sub MyTimer_Elapsed(ByVal sender As Object, ByVal e As System.Timers.ElapsedEventArgs) Handles MyTimer.Elapsed
'
'  do whatever you need
' 
End Sub
lolafuertes 145 Master Poster

.

lolafuertes 145 Master Poster

On the MySqlDataAdapter you only defined the SELECT command. You need to fill in the Insert, Delete and Update commands of the data adapter.
Then on your code 2, after myTable.AcceptChanges() youmust add

Msadptr.Update

Hope this helps

lolafuertes 145 Master Poster

Hopefully you may want not a windows program running, waiting for a timer during one month.

The best way is to isolate this functionalty in a separate console application and use the task scheduler of Windows to planify when, and under wich user, must be executed.

Be aware that this console application can not have any interactive screen or message, as is running in batch, and should end gently.

Hope this helps

lolafuertes 145 Master Poster

When you declare the data adapter, you only fill in the SELECT Command.

In order the data adapter can modify the data base contents, you need also to define the Insert, Delete and Update commands for the da on FormElectricalWorkshopCertNew_Load, before isuuing the da.Update(dt) in butCont2_Click.

Hope this helps

lolafuertes 145 Master Poster

@marketingmaniac:
On the original post jcfans wrote

may i know how to add 4 new column to existing table("customer") automatic after split the string?

Why is needed a Listview to add data to the existing "customer" table?

Wich is the mechanism that adds the items from the listview to the database?

Is necessary the header in order to add the records to the table?

Sorry, as jcfans I am lost.

lolafuertes 145 Master Poster

In your MS Access database, if you do not have already defined the relations between the tables, do it using the data base tools. The Patient should be the "Parent" table and NOK and Admission should be "Children"

When defining the relations, see on the bottom a check box to cascade delete the related records.

Then, issuing a delete againsi the Patient will kill the children table records related to the deleted patient.

Hope this helps

lolafuertes 145 Master Poster

may i know how to add 4 new column to existing table("customer") automatic after split the string?

Assuming that the text top split is in a string called TextTosplit, and the split charcter is the "-", you can separate then into a string array using some thing like

Dim StringParts as String() = TextToSplit.Split("-"c)

To add this info in the ds.tables(0) as a new row you can:

If stringParts.Lenght = 4 Then' To verify that has the required number of fileds
    ds.tables(0).Rows.Add(StringParts)
End If

Hope this helps

lolafuertes 145 Master Poster

The application is stopping to execute the method at cmd.ExecuteNonQuery() part

Sorry, what do you mean? Is just Hunging? Or is there any message?

On your las try you can change the lines

cmd = New OleDBCommand(mySqlQuery, dbConn1)
cmd.Connection = dbConn1
cmd.Transaction = trans
   Try
      cmd.CommandText = mySqlQuery
      cmd.ExecuteNonQuery()

by

cmd = New OleDBCommand(mySqlQuery, dbConn1, trans)
Try
   cmd.ExecuteNonQuery()
lolafuertes 145 Master Poster

I'm using VS2008
Professional should be ok for you.
MS SQL server Standard on the server shoud be enough.

lolafuertes 145 Master Poster

Did you already tryed:

For each C as Control In Form.Controls
'
'    Do here what you need for each control
'
Next

?

lolafuertes 145 Master Poster

There is a very big lot of things you can do with Excel: http://msdn.microsoft.com/en-us/library/syyd7czh(v=VS.80).aspx

Also you gan get the entire Excel Object Model at http://msdn.microsoft.com/en-US/library/wss56bz7(v=VS.80).aspx

lolafuertes 145 Master Poster

I use the Enterprise Architect version for VS and the Enterprise for MS SQL.
IMO it worth the effort.

Hope this helps

lolafuertes 145 Master Poster

Asumming table2 beewn the PaseId and descriptino table, you can bind this table as datasource for a dropdown listbox in your aspx page. On the dropdownlist task you can select table2 as the data source, select the description in the data text field to display, and select the phaseid for the data value field of the dropdown list.

Hope this helps

lolafuertes 145 Master Poster

Did you 'create' drives in other OS versions? How?
What kind of message you need to send to local host?
The administrator account is disabled for severe security reasons. The system asks you permissions every time this account is required so basically you don't need to use it.
Any way, you can enable the account opening a cmd console then issuing a net user command to set it to active

lolafuertes 145 Master Poster

Please, put what you've coded so far and a signal where you have doubts.

lolafuertes 145 Master Poster

it is enough to change

objExcel.ActiveSheet.Cells(row, column).Value = "cell data"
lolafuertes 145 Master Poster

Add a sub like

Sub ApplyCulture(Byval SelectedCulturename as String)
	Dim Rm As New Resources.ResourceManager("YourProject.YourFormClass", System.Reflection.Assembly.GetExecutingAssembly())
	Dim Ci As System.Globalization.CultureInfo = New System.Globalization.CultureInfo(SelectedCultureName)
	Me.Text = Rm.GetString("$this.Text", Ci)
.
.	' you need to do this for all controls having a distinct text depending on the language
.
	Me.btnWhatItWas.Text = Rm.GetString("btnWhatItWas.Text", Ci)
.
.
.
End Sub

Then call this sub at the load event of the form. Also when you want to change the interface language.

Hope this helps

lolafuertes 145 Master Poster

In order to use the data base in the server, you should install the SQL Server server part in the server.

Then change the connection string from local to the server.

You need another project, a Setup one, in order to properly publish your application. If you use the wizard, select only the primary outputfrom the User Interface. It will scan for all required denpendencies.

lolafuertes 145 Master Poster

After

Dim con As New ADODB.Connection

Where do you add the connection string and issue the open method?

lolafuertes 145 Master Poster

@GeekByChice: Here are many referenced classes thar are not part of the code shown. If my deduction is right, the clsConexion class is used to manage connections. This class has a Cierra method that 'should' close the connection to the db and is called at the end of Procesa sub.

@Orlando: In the AgregaLinea method of aoFactura, do you use a begin transaction to update the underlying db, then commit the transaction if Ok or else rollback?
I se you use many times the With New sentence. Do you really need a new instance of the object (ie: Datos.clsParametro in the ValorParametro or cambiaEstadoTransaction functions)?

Espero que esto ayude

lolafuertes 145 Master Poster

From my knowledge there is no direct support for Hijri dates inside ACCESS. The best way is to save them into text form of CCYY-MM-DD.

You must write yur own functions in ACCESS to manage such dates as all the 12 months are 28 days each.

lolafuertes 145 Master Poster

This can happen for many reasons.

The most commons are:
* the creation of objects that never are disposed. IE: Inside a never ending loop, SomeThing = new WhatItWas
* Infinite recursivity
* Lots of pending transactions in memory, big tables or collections, etc.

If you post your code, we can try to analyze where the problem is.

Hope this helps

lolafuertes 145 Master Poster

Your SELECT, as is written, is called a cross join. This will mean that all the rows of facilitada are merged to each row in customer data, then the resulting set is merged to each row in employee data.

If you have 3 rows in the first table, 2 on the second one and 4 in the 3rd the result will be 24 rows.

Maybe this is not what you expect.

Try to change the SELECT using some INNER JOIN clause defining how to relate the tables.

Hope this helps

lolafuertes 145 Master Poster

In Visual Studio create a new console project. Inside the presented source code, between the lines Sub Main and End Sub, write

Console.WriteLine ("Hello world. Try to press a key")
   Console.ReadKey

Compile and execute. You can guess the result.

Hope this helps

lolafuertes 145 Master Poster

In your first try you have some problems:
1) Each time you call the getDBConn() you obtain a New Connection, but... because is exactly the same as any previous call, the connection poll will try tu use the same.
2) When you issue the 'If setUsersOnline(username) = True Then' sentence, the the data reader still open. It should be closed before issuing any update to the DB.
3) On your first try, you miss to set the Insert, Update and Delete commands of the data adapter so, when you call dadap.Update(dtable) nothing can happen.
4) On your last try, nothing happens? Do you get an error message? Anyway I think is better to instantiate a new Sql Command in your setUsersOnline sub.

Hope this helps

lolafuertes 145 Master Poster

About your original question, you are comparing two cells of the same row, so there is info only about one year (2005 or 2006) in the e.Row.Cells(3).Text.

On CellValue2 and CellValue3 you will have the text "True" on one of them, and "False" on the other.

Maybe is easier to:

Dim CellValue2 As Boolean = e.Row.Cells(3).Text) = "2005"
Dim CellValue3 As Boolean = Not Cellvalue2

in order to use it in

If CellValue2 AndAlso CellValue < 0.0 Then

Where do you have the info for the two consecutive years?

lolafuertes 145 Master Poster

@zulhimi89:
Lets A = 1, B = 2, C = 3, D = 3
If A=B And C=D Then

First (Evaluate A=B) to False
Then (Evaluate C=D) to True
Then (evaluate False And True) to False
Return False

If A = B AndAlso C = D Then

First (evaluate A=B) to False
Return False

If C = D AndAlso A = B Then
First (evaluate C=D) to True
Then (evaluate A=B) to False
Return False

Example:

Dim A As Object = Nothing
If ( Not A Is Nothing ) And A.tostring = "3"

Will fail to evaluate and launch an exception because is trying to evaluate A.Tostring and the object is not instantiated while

If ( Not A Is Nothing ) AndAlso A.tostring = "3"

will not fail because (Not A Is Nothing) is false and does not continues to evaluate the rest of conditions.

Hope this helps

lolafuertes 145 Master Poster

@P0IT10n: The And logical operator evaluates all the compares, then 'Ands' the results. If only one of them is False, then the And operator returns false.
The AndAlso operator evaluates the first. If the result is true, then compares the second and so on. This way, the very first false, cuts the evalutaion of the others compares saving CPU cicles.

lolafuertes 145 Master Poster

In the form where you pull the data from Table1, change the select string to 'join' both tables using the integer identifying the phase on each one like
"SELECT [Table1].[CurrentPhaseInt], [Table2].[Description] FROM [Table1] INNER JOIN [Table2] ON [Table1].[CurrentPhaseInt] = [Table2].[PhaseIdInt] "

Hope this helps

lolafuertes 145 Master Poster

Hopefully you have a Main (parent) form, where to place the tool strip, that you already set the IsMdiContainer property to True.
When you launch the additional forms from this one, you set the MdiParent property of the children form pointing to the Main form.

Dim F as new frmChildForm1
F.MdiParent = Me
F.Show

In each child form, you should add a Public sub or function that deletes the data related only to this child form.

Public Sub Delete
'
'    Delete whatever you need
'
End Sub

On the Main form, when the user clicks the tool strip 'Delete' button, you can cicle over the children forms

For Each ChildForm as Form In Me.Children
    
Next

Inside the loop you can place validations to determine wich one is the child form and call the Delete sub

If ChildForm Is frmChildForm1 Then
    Directcast(ChildForm, frmChildForm1).Delete
ElseIF ChildForm Is frmChilForm2 Then
    Directcast(ChildForm, frmChildForm2).Delete
.
.
.
Else
    ' Do Nothing
End IF

Hope this helps

lolafuertes 145 Master Poster

Can you post your code to show where you find the extra info?

lolafuertes 145 Master Poster

The rtf box has two properties related:
.Text Is the text 'without' formatting
.Rtf is the same text 'with' formatting (the stuff you do not need).

When you save the file, you sould save the .rtf contents and, when loading, load the .rtf instead of the .text.

Hope this helps