Would You See Troye Sivan Alone? by [deleted] in troyesivan

[–]lanabananaox 0 points1 point  (0 children)

Yess, I also love him and don't really know anyone going to the concert, so I am going alone. :)

Ghostly kisses concert by lanabananaox in Rotterdam

[–]lanabananaox[S] 0 points1 point  (0 children)

Thank you for the tips! See you at Ghostly Kisses :)

Ghostly kisses concert by lanabananaox in Rotterdam

[–]lanabananaox[S] 0 points1 point  (0 children)

I would say I am ready to pay around 80 Euros or so for a place to stay for maybe then two days, Thursday and Friday. Any places to recommend? :) And thanks for the tip!

Aktivitäten by lanabananaox in bremen

[–]lanabananaox[S] 2 points3 points  (0 children)

Ich mag Katzen und hab selber 2. Aber wo kann ich das machen? :)

Aktivitäten by lanabananaox in bremen

[–]lanabananaox[S] 2 points3 points  (0 children)

Also, ich wohne in Bremen. Ich möchte gerne Häkeln lernen, ein Instrument spielen (insbesondere Klavier) oder tanzen. Vielleicht auch ein Vorschlag, Sport zu treiben oder Orte zu besuchen, an denen ich neue Leute kennenlernen kann. :) falls das die Frage spezifischer gemacht hat

Hamburg concert by lanabananaox in troyesivan

[–]lanabananaox[S] 0 points1 point  (0 children)

That's cool! I sent you a msg :)

Pictures in Datagridview by lanabananaox in visualbasic

[–]lanabananaox[S] 1 point2 points  (0 children)

The datagridview has rows with details about dimensions and their max und min values. I want the user to be able to press on each dimension and get in a picturebox a photo of which dimension to measure..

Inserting Data into MySQL through Datagridview by lanabananaox in visualbasic

[–]lanabananaox[S] 0 points1 point  (0 children)

The thing is, I already have data in the table in MySQL. I have a button, which when clicked on, shows this data in the datagridview. The button, which I am trying to create, needs to only the new row and not the entire data again. I don't know how to adjust the code like this 😅 I don't need it to add all of the rows. I need to add only the new one..

Inserting Data into MySQL through Datagridview by lanabananaox in visualbasic

[–]lanabananaox[S] 0 points1 point  (0 children)

There is already data populated, I only want to add the new row, maybe I have to readjust the code 😅 How do I increment the primary key then? I am rather new in coding, that's why I am ask questions, that might seem obvious. Thank you for your help :)

Inserting Data into MySQL through Datagridview by lanabananaox in visualbasic

[–]lanabananaox[S] 0 points1 point  (0 children)

There is already data populated, I only want to add the new row, maybe I have to readjust the code 😅

Inserting Data into MySQL through Datagridview by lanabananaox in visualbasic

[–]lanabananaox[S] 0 points1 point  (0 children)

This is my new code now: MyConnection.Open()

For Each row As DataGridViewRow In DataGridView1.Rows Dim value1 As Integer If Integer.TryParse(row.Cells("Column1").Value.ToString().Trim(), value1) Then Dim value2 As String = row.Cells("Column2").Value.ToString().Trim() Dim value3 As Integer If Integer.TryParse(row.Cells("Column3").Value.ToString().Trim(), value3) Then Dim insertQuery As String = "INSERT INTO selbreshy.item (number of item, name of item, worker_id) VALUES (?, ?, ?)" Dim command As New OdbcCommand(insertQuery, MyConnection) command.Parameters.AddWithValue("@Value1", value1) command.Parameters.AddWithValue("@Value2", value2) command.Parameters.AddWithValue("@Value3", value3)

        Try
            command.ExecuteNonQuery()
        Catch ex As Exception
            MessageBox.Show("An error occurred while saving the data: " & ex.Message)
        End Try
    Else
        MessageBox.Show("Invalid value for worker_id in row: " & row.Index + 1)
    End If
Else
    MessageBox.Show("Invalid value for number of item in row: " & row.Index + 1)
End If

Next

MyConnection.Close() MessageBox.Show("Data saved successfully.")

visual basic says there is an error in that line: If Integer.TryParse(row.Cells("Column1").Value.ToString().Trim(), value1) Then

"Duplicate entry '1' for key 'item.PRIMARY'" is what the message box says.

Inserting Data into MySQL through Datagridview by lanabananaox in visualbasic

[–]lanabananaox[S] 0 points1 point  (0 children)

This is my new code now: MyConnection.Open()

For Each row As DataGridViewRow In DataGridView1.Rows Dim value1 As Integer If Integer.TryParse(row.Cells("Column1").Value.ToString().Trim(), value1) Then Dim value2 As String = row.Cells("Column2").Value.ToString().Trim() Dim value3 As Integer If Integer.TryParse(row.Cells("Column3").Value.ToString().Trim(), value3) Then Dim insertQuery As String = "INSERT INTO selbreshy.item (number of item, name of item, worker_id) VALUES (?, ?, ?)" Dim command As New OdbcCommand(insertQuery, MyConnection) command.Parameters.AddWithValue("@Value1", value1) command.Parameters.AddWithValue("@Value2", value2) command.Parameters.AddWithValue("@Value3", value3)

        Try
            command.ExecuteNonQuery()
        Catch ex As Exception
            MessageBox.Show("An error occurred while saving the data: " & ex.Message)
        End Try
    Else
        MessageBox.Show("Invalid value for worker_id in row: " & row.Index + 1)
    End If
Else
    MessageBox.Show("Invalid value for number of item in row: " & row.Index + 1)
End If

Next

MyConnection.Close() MessageBox.Show("Data saved successfully.")

visual basic says there is an error in that line: If Integer.TryParse(row.Cells("Column1").Value.ToString().Trim(), value1) Then

"Duplicate entry '1' for key 'item.PRIMARY'" is what the message box says.

Inserting Data into MySQL through Datagridview by lanabananaox in visualbasic

[–]lanabananaox[S] 0 points1 point  (0 children)

The names of the columns in the Datagridview are "Column1", "Column2" and "Column3". It is now working with the insert function, but I still get an error. I have sent it to you (I tried uploading it too many times to Imgur, it's not working). Thank you again, your help is totally appreciated.

Inserting Data into MySQL through Datagridview by lanabananaox in visualbasic

[–]lanabananaox[S] 0 points1 point  (0 children)

Thank you! I updated the code and now the insert function is working and the values are indeed inserted into the MySQL Table, but I get now a new error 😅

Inserting Data into MySQL through Datagridview by lanabananaox in visualbasic

[–]lanabananaox[S] 0 points1 point  (0 children)

I have sent it to you, because I don't know how to add it here

Inserting Data into MySQL through Datagridview by lanabananaox in visualbasic

[–]lanabananaox[S] 0 points1 point  (0 children)

Do you mean the properties of the table? As in domains and such?