- Get link
- X
- Other Apps
Public Sub Inserir_Registro_GraficoSistema(ByVal xGrafico As String, ByVal xColuna As String, ByVal xValor As Integer, ByVal xUsuario As String)
Dim cmd As New SqlCommand
Dim conn As New SqlConnection
conn.ConnectionString = ConfigurationManager.ConnectionStrings("MyonnectionString").ConnectionString
cmd.Connection = conn
Dim str As New StringBuilder
str.AppendLine(" INSERT INTO [TB_XXXX] ")
str.AppendLine(" ([A] ")
str.AppendLine(" ,[B] ") str.AppendLine(" ,[C] ")
str.AppendLine(" ,[D])")
str.AppendLine(" VALUES ")
str.AppendLine(" (@A ")
str.AppendLine(" ,@B ")
str.AppendLine(" ,@C ")
str.AppendLine(" ,@D )")
cmd.CommandText = str.ToString
cmd.CommandType = CommandType.Text
cmd.Parameters.Add(New SqlParameter("@A", SqlDbType.VarChar)).Value = xA cmd.Parameters.Add(New SqlParameter("@B", SqlDbType.VarChar)).Value = xB cmd.Parameters.Add(New SqlParameter("@C", SqlDbType.Int)).Value = xC
cmd.Parameters.Add(New SqlParameter("@D", SqlDbType.VarChar)).Value = xD
conn.Open()
cmd.ExecuteNonQuery()
cmd.Dispose() cmd = Nothing
conn.Close()
conn.Dispose()
End Sub
Dim cmd As New SqlCommand
Dim conn As New SqlConnection
conn.ConnectionString = ConfigurationManager.ConnectionStrings("MyonnectionString").ConnectionString
cmd.Connection = conn
Dim str As New StringBuilder
str.AppendLine(" INSERT INTO [TB_XXXX] ")
str.AppendLine(" ([A] ")
str.AppendLine(" ,[B] ") str.AppendLine(" ,[C] ")
str.AppendLine(" ,[D])")
str.AppendLine(" VALUES ")
str.AppendLine(" (@A ")
str.AppendLine(" ,@B ")
str.AppendLine(" ,@C ")
str.AppendLine(" ,@D )")
cmd.CommandText = str.ToString
cmd.CommandType = CommandType.Text
cmd.Parameters.Add(New SqlParameter("@A", SqlDbType.VarChar)).Value = xA cmd.Parameters.Add(New SqlParameter("@B", SqlDbType.VarChar)).Value = xB cmd.Parameters.Add(New SqlParameter("@C", SqlDbType.Int)).Value = xC
cmd.Parameters.Add(New SqlParameter("@D", SqlDbType.VarChar)).Value = xD
conn.Open()
cmd.ExecuteNonQuery()
cmd.Dispose() cmd = Nothing
conn.Close()
conn.Dispose()
End Sub
Comments