Dim Connection As SqlConnection = New SqlConnection() Connection.ConnectionString = "Persist Security Info=False; Integrated Security=SSPI; database=MonEntreprise; server=Chris-PC" Connection.Open() Dim SQL As SqlCommand = New SqlCommand("INSERT INTO TypeAppareil1(idAppareil, MarqueAppareil, Modele) VALUES(" & txt_marque.Text & "," & txt_marque.Text & ", " & txt_modele.Text & ")", Connection) Dim DataReader As SqlDataReader DataReader = SQL.ExecuteReader()
Dim NbLine As Integer = TypeAppareilTableAdapter.Insert(txt_numSerie.Text, txt_marque.Text, txt_modele.Text) Me.TypeAppareilTableAdapter.Fill(Me.MonEntreprise.TypeAppareil)
Dim SQLStr As String Dim ConnString As String 'Connstring = Server Name, Database Name, Windows Authentication ConnString = "Data Source=.\database1;Initial Catalog=.\MonEntreprise;Integrated Security=True" 'SQL Staments 'SQL query myQuery "SQL Statment" SQLStr = "INSERT into typeAppareil VALUES(txt_numSerie.text, txt_Marque.Text, txt_modele.text)" 'Write to SQL Dim SQLConn As New SqlConnection() 'The SQL Connection Dim SQLCmd As New SqlCommand() 'The SQL Command SQLConn.ConnectionString = ConnString 'Set the Connection String SQLConn.Open() 'Open the connection SQLCmd.Connection = SQLConn 'Sets the Connection to use with the SQL Command SQLCmd.CommandText = SQLStr 'Sets the SQL String SQLCmd.ExecuteNonQuery() 'Executes SQL Commands Non-Querys only SQLConn.Close() 'Close the connection
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question