Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - MEDALI1TN

Pages: [1] 2 3 4
1
Open Discussion / Re: write to a database from datagridview
« on: June 26, 2022, 05:40:34 AM »
There is any other solution to convert data from Firebird to Mysql database.

2
Open Discussion / write to a database from datagridview
« on: June 17, 2022, 01:35:23 PM »
I want to convert data from Firebird database to Mysql database, so i managed to put the data in the datagridview and after that i managed also to write those data in the Mysql database.
until now everything seems perfect.
I wanted to write in the database only new records.

Code: [Select]
Imports System.Configuration
Imports MySql.Data
Imports MySql.Data.MySqlClient
Imports System.Data.DataTable
Imports System.Data.SqlClient
Imports System.Data.Odbc
Imports System.Data
Imports System.Data.Odbc.OdbcCommand
Imports System.Data.OleDb

Public Class MainForm
    Public conn_odbc As OdbcConnection
    Public conn1 As OdbcConnection
    Public conn2 As OdbcConnection
    Public ConnMysql_protocol As MySqlConnection

Public Sub connection_to_firebird_prod()
        Dim str_odbc_prod As String
        str_odbc_prod = "DRIVER=Firebird/InterBase(r) driver;UID=****;PWD=****;DBNAME=*****.GDB;"
        conn1 = New OdbcConnection(str_odbc_prod)
    End Sub

Public Sub production()
        Dim str_odbc_prod As String
        str_odbc_prod = "DRIVER=Firebird/InterBase(r) driver;UID=****;PWD=****;DBNAME=****.GDB;"
        Dim odbc_connection_prod As New OdbcConnection(str_odbc_prod)
        Dim odbc_adapter_prod As New OdbcDataAdapter("select ID,NR,HR from FrirebirdTable", odbc_connection_prod)
        Dim table_odbc_prod As New DataTable
        odbc_adapter_prod.Fill(table_odbc_prod)
        DataGridView_production.DataSource = table_odbc_prod
        odbc_adapter_prod.Dispose()
        Dim mysql_connection_prod As New MySqlConnection("server=localhost;user id=****;database=mysqldatabase")
        Dim insert_in_mysql_prod As New MySqlCommand("INSERT INTO `mysqltable` (`ID`, `NR`, `HR`) VALUES (@ID,@NR,@HR)", mysql_connection_prod)
        Try
            mysql_connection_prod.Open()
        Catch exError As MySqlException
        End Try
        For i As Integer = 0 To DataGridView_production.RowCount - 1 Step +1
            insert_in_mysql_prod.Parameters.Add("@ID", MySqlDbType.Int64).Value = DataGridView_production.Rows(i).Cells(0).Value.ToString
            insert_in_mysql_prod.Parameters.Add("@NR", MySqlDbType.Int64).Value = DataGridView_production.Rows(i).Cells(1).Value.ToString
            insert_in_mysql_prod.Parameters.Add("@HR", MySqlDbType.Int64).Value = DataGridView_production.Rows(i).Cells(2).Value.ToString
           
            insert_in_mysql_prod.ExecuteNonQuery()
        Next
        mysql_connection_prod.Close()

    End Sub

End Class


3
Open Discussion / Re: Driver Siemens with Snap7
« on: July 16, 2021, 04:41:18 AM »
Hello Tatin,
can you please write a simple code (for a beginner) how can i read a value from PLC using the driver.
The example of siemens variables :
(DBxxxx,DDxxxx)
(DBxxx,Dxx.x)
(Exxxx.x)
(PEWxxxx)

4
Open Discussion / Re: datagridview : auto update
« on: April 30, 2020, 05:02:06 AM »
Thanks
I found it, just make an update to the query.

5
Open Discussion / datagridview : auto update
« on: April 29, 2020, 09:51:36 AM »
How can I make auto update of the datagridview in vb.net.

6
Hello, I leave the link with the siemens driver using snap7, in front of any doubt I will try to help as much as I can since I am not an expert in .net programming, I do what I can. I have tested it with snap7's own simulator and with an S7-1500 PLC. (sorry my english is translated)

https://drive.google.com/open?id=1qkjWns0W4z6uQtiWrUeaWBJl4oHMxAaC

Dear tatin.
Can use it with s7-300 or s7-400 ?

7
Open Discussion / Re: using a temporary table
« on: February 18, 2019, 04:59:16 PM »
no it's not very important.
the most important thing is to be able to do tests in my program and I need the history of the variables.

8
Open Discussion / Re: using a temporary table
« on: February 18, 2019, 04:51:20 PM »
if i can keep the values of the variables even after they change it will be better.

9
Open Discussion / Re: using a temporary table
« on: February 18, 2019, 04:37:03 PM »
i'm not binding the DGV to nothing, just i want to save some variable that i read with OPC to a temporary table ... and i think that the DGV can help me.

10
Open Discussion / Re: using a temporary table
« on: February 18, 2019, 03:59:19 PM »
if i can fill a Datagridview column with a Variable i think i can solve my problem.
thank you

11
Open Discussion / Re: using a temporary table
« on: February 17, 2019, 07:43:19 AM »
it sounds a bit like what you said.
in fact, I want to save values that come from a temporary database (from another
production management application) via opc.
because the values change all the time, I have to save them to another table in my program with incrementing each time the values change.
I used variables but it did not work because with each change it crushes the previous value.

12
Open Discussion / Re: using a temporary table
« on: February 16, 2019, 04:47:57 PM »
Thank you for your answers.
simply, I want to store values that exists in a table of an application that communicates with the PLC (which I read through OpcDaCom).
This table is temporary, it changes these values for each new production order.
I want to store his contents so that I can do other treatments afterwards.

13
Open Discussion / using a temporary table
« on: February 16, 2019, 03:48:04 PM »
Dear All,
In my code, I read an "X" variable that exists in a temporary table in another application (which I read this variable through the OPC server).

I want to keep this variable "X" in another temporary table in my code even after the disappearance of the table of the other application.

whenever the variable "X" changes in the temporary table of the other application, I must create a new column in my temporary table and save it in it.

Thx

14
Open Discussion / Re: using class with AdvancedHMI
« on: December 29, 2018, 07:31:40 AM »
Hello,
I do not use the the BasicDataLogger.
i use this code (exemple with one variable) :

Code: [Select]

  Dim conString As String = "server=localhost;userid=root;password=;database=my_database"
            Using con As New MySqlConnection(conString)
                Using cmd As New MySqlCommand
                    With cmd
                        .Connection = con
                        .CommandText = "insert into my_database.my_table (var1) values (@var1)"
                        .CommandType = CommandType.Text
                        .Parameters.AddWithValue("@var1", var1)
                   
                    End With
                    Try
                        con.Open()
                        cmd.ExecuteNonQuery()
                        con.Close()
                    Catch ex As MySqlException
                        MessageBox.Show(ex.Message + System.Environment.NewLine, "MySQL Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
                    End Try
                End Using
            End Using


if the BasicDataLogger is better, please told me how can i use it in order to have the same result.

15
Open Discussion / Re: using class with AdvancedHMI
« on: December 27, 2018, 10:39:49 AM »
I have a lot of variables and a lot of connection to different database tables.
As all the code is written under the MainForm, each time the program executes all the code.
when i open the app it can stay 10 min for it to appear.
Also it become very difficult to understand.

Pages: [1] 2 3 4