'How can I solve error 102 state 1 class 15 visaul studio?
Can someone help me solve this visual studio problem ? I created a data base project, however, it doesn't run and I can't understand why. It keeps showing this. enter image description here
If (txt_capacidadeaviao.Text = Nothing) Then lbl_msg.Text = "Tem de introduzir a capacidade do avião" txt_capacidadeaviao.Focus() Exit Sub
End If
Dim conn As SqlConnection = New SqlConnection(Classe_Global.string_conexao_bd)
Dim cmd As SqlCommand = New SqlCommand()
cmd.CommandText = "INSERT INTO Tbl_Voo (modeloaviao_voo, ndevoo_voo, aeroportopartida_voo, aeroportochegada_voo,datapartida_voo,datachegada_voo,horapartida_voo,horachegada_voo,capacidadeaviao_voo" _
& " VALUES (@modeloaviao_voo,@ndevoo_voo, @aeroportopartida_voo, @aeroportochegada_voo, @datapartida_voo, @datachegada_voo, @horapartida_voo, @horachegada_voo, @capacidade_voo)"
cmd.Parameters.Add("@modeloaviao_voo", SqlDbType.NVarChar, 10).Value = txt_modeloaviao.Text
cmd.Parameters.Add("@ndevoo_voo", SqlDbType.NVarChar, 10).Value = txt_ndevoo.Text
cmd.Parameters.Add("@aeroportopartida_voo", SqlDbType.NVarChar, 50).Value = txt_aeroportopartida.Text
cmd.Parameters.Add("@aeroportochegada_voo", SqlDbType.NVarChar, 50).Value = txt_aeroportochegada.Text
cmd.Parameters.Add("@datapartida_voo", SqlDbType.NVarChar, 10).Value = txt_datapartida.Text
cmd.Parameters.Add("@datachegada_voo", SqlDbType.NVarChar, 10).Value = txt_datachegada.Text
cmd.Parameters.Add("@horapartida_voo", SqlDbType.NVarChar, 10).Value = txt_horapartida.Text
cmd.Parameters.Add("@horachegada_voo", SqlDbType.NVarChar, 10).Value = txt_horachegada.Text
cmd.Parameters.Add("@capacidade_voo", SqlDbType.NVarChar, 0).Value = txt_capacidadeaviao.Text
cmd.Connection = conn
conn.Open()
THIS IS ONLY A PART OF THE CODE BECAUSE I CANT PASTE IT ALL BUT I THINK THE ERROR IS IN THIS PART RELATED MAYBE WITH THE CONNECTION STRING.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
