08-15-2018
08:04 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
08-15-2018
08:04 AM
Finally did it,
SyntaxEditor Code Snippet
AddReference "System.Data" AddReference "System.Core" AddReference "System.Xml" Imports System.Data.OleDb Imports System.Data Imports System.Xml
SyntaxEditor Code Snippet
Sub Main() ' Dim Tabla As String = "CAD" Dim query As String = "SELECT * FROM CAD WHERE PartNo = '" & MT_NAMING & "'" Dim MDBConnString_ As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\\DESKTOP-VDT88EI\database\Ingenieria.accdb;Persist Security Info=False;" Dim ds As New DataSet Dim cnn As OleDbConnection = New OleDbConnection(MDBConnString_) cnn.Open() Dim cmd As New OleDbCommand(query, cnn) Dim da As New OleDbDataAdapter(cmd) da.Fill(ds, "CAD") cnn.Close() Dim **** = ds.Tables("CAD").rows.count If **** > 0 Then MessageBox.Show(**** & "This Part Number is allready added to the database!", MT_NAMING ) Else Dim OPROJ As String Dim oCREAT As String Dim oDAT As Date Dim oCOMENT As String Dim oSTATUS As String oNAME = MT_NAMING OPROJ = iProperties.Value("Project", "Project") oDAT = iProperties.Value("Project", "Creation Date") oCREAT = ThisApplication.GeneralOptions.UserName oCOMENT = DESCRIPCION oSTATUS = STATUS_MASTER Dim Table_ As String = "CAD" Dim query1 As String = "INSERT INTO " & Table_ & "(Proyect, PartNo, AutorDePieza, FechaCreacion, DescripcionDePieza,Estado) VALUES ('"&iProperties.Value("Project", "Project")&"','"& MT_NAMING &"', '"& oCREAT &"', '"& oDAT &"', '"& oCOMENT &"', '"& STATUS_MASTER &"')" Dim MDBConnString_1 As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\\DESKTOP-VDT88EI\database\Ingenieria.accdb;Persist Security Info=False;" Dim ds1 As New DataSet Dim cnn1 As OleDbConnection = New OleDbConnection(MDBConnString_1) cnn1.Open() Dim cmd1 As New OleDbCommand cmd.Connection = cnn1 cmd.CommandText = query1 cmd.ExecuteNonQuery() cnn1.Close() End If End Sub