Results 1 to 3 of 3

Thread: Impasse in project and Porting to python

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2020

    Impasse in project and Porting to python

    Hello all, hopefully I'm posting in the right place. I'm working on a project that allows customers to scan a bar code with a scan gun, they click upload and it sends the code to a mysql database where it can be viewed and sorted. We were planning on using a Raspberry Pi 4 with Raspbian and use Mono to run the .exe file. That turned out to be a dead end. We still want to use the Raspberry Pi so we've opted to attempt in eliminating windows from the equation. The easiest for us would be moving to Python. I am a very new programmer, so constructive criticism is welcomed. Finally, my question is: Can anyone help me brainstorm/give me ideas and guidance on how this code should look in Python?

    Thank you so much for your time and assistance!

    (Again, I'm a new programmer, I realize there are better alternatives to most of my code, which is why I'm here. Thank you!)

    Imports MySql.Data.MySqlClient
    Public Class Form1
        Dim Uname As String
        ReadOnly connection As New MySqlConnection("datasource=;port=3306;username='root';password='Khajiit19!';database = Barcodes")
        Private Sub Label1_Click(sender As Object, e As EventArgs)
        End Sub
        Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBoxPassword.TextChanged, TextBoxUsername.TextChanged
        End Sub
        Private Sub CheckBoxSP_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBoxSP.CheckedChanged
            If TextBoxPassword.UseSystemPasswordChar = True Then
                TextBoxPassword.UseSystemPasswordChar = False
                TextBoxPassword.UseSystemPasswordChar = True
            End If
        End Sub
        Private Sub ButtonCancel_Click(sender As Object, e As EventArgs) Handles ButtonCancel.Click
        End Sub
        Private Sub ButtonLogin_Click(sender As Object, e As EventArgs) Handles ButtonLogin.Click
            Dim command As New MySqlCommand("SELECT `username`, 'password' FROM `Accounts` WHERE `username` = @username AND `password` = @password;", connection)
            command.Parameters.Add("@username", MySqlDbType.VarChar).Value = TextBoxUsername.Text
            command.Parameters.Add("@password", MySqlDbType.VarChar).Value = TextBoxPassword.Text
            Dim adapter As New MySqlDataAdapter(command)
            Dim table As New DataTable()
            Catch ex As Exception
                MessageBox.Show("Could Not Connect To MySQL Server")
            End Try
            If table.Rows.Count = 0 Then
                MessageBox.Show("Invalid username or password")
            ElseIf MessageBox.Show("Login Succesful") Then
                Dim Barcode = New Barcode()
            End If
        End Sub
    End Class

  2. #2
    Fanatic Member Delaney's Avatar
    Join Date
    Nov 2019
    Paris, France

    Re: Impasse in project and Porting to python


    There exist a few converters (here and here) but I don't know if they are reliable. Do you know python language ?

    As you use mysql, I'd say the first would be to have a look to how to use it with python and then try to find some tutorial, code example in python to use a bar code scan system.

    Maybe you could try to post it on a python forum or on stack overflow python forum

    Last edited by Delaney; May 19th, 2020 at 04:42 AM.
    The best friend of any programmer is a search engine
    "Don't wish it was easier, wish you were better. Don't wish for less problems, wish for more skills. Don't wish for less challenges, wish for more wisdom" (J. Rohn)

  3. #3
    Frenzied Member jdc2000's Avatar
    Join Date
    Oct 2001
    Idaho Falls, Idaho USA

    Re: Impasse in project and Porting to python

    You can run Windows 10 IoT Core on the Raspberry Pi:

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width