• Sábado 27 de Abril de 2024, 18:16

Mostrar Mensajes

Esta sección te permite ver todos los posts escritos por este usuario. Ten en cuenta que sólo puedes ver los posts escritos en zonas a las que tienes acceso en este momento.


Temas - Baliam

Páginas: [1]
1
C# / ¿Aplicación c# para insertar datos en una bd nsf?
« en: Lunes 27 de Septiembre de 2010, 15:56 »
Buenos Días, he pedido ayuda en muchos pero nadie me ha podido ayudar, la verdad estoy algo desperado y apunto de redirme. Ojala, alguien me pueda ayudar.

Tengo el siguiente problema:
Estoy tratando de crear una aplicación para insertar datos en las bases nsf de lotus notes mediante una aplicación de C#. Hasta el momento llevo esto:
private void button2_Click(object sender, EventArgs e)
{
bool isServerData = radioButton1.Checked;
// Set up connection string
string connString = ("Driver=Lotus NotesSQL Driver (*.nsf);" + ("Server=" + textBox1.Text + ";" + "Database=C:\Archivos de programa\Lotus\notes\data\clientes\… + "UserName = 192.168.*.*" +";" + "Password= "+ textBox2.Text + "" ));
string CmdString = "SELECT * FROM Contactos";
OdbcConnection Conn = null;
OdbcDataReader Reader = null;
OdbcDataAdapter adaptador = new OdbcDataAdapter();
DataTable contactos;
string con = connString;
//string sel = ("INSERT INTO Contactos (_126, _21, _19, _20) VALUES(?, ?, ?, ?) ");
string sel = "INSERT INTO Contactos (_126, _21, _19, _20) VALUES('Luisa', 'noexiste@nohay.com', '55555555', 'programador')";
try
{
// Open Connection

/***************************************…
Conn = new OdbcConnection(connString);
Conn.Open();

// Execute Query
OdbcCommand Cmd = new OdbcCommand(CmdString, Conn);
adaptador = new OdbcDataAdapter(Cmd);
contactos = new DataTable();
adaptador.Fill(contactos);
adaptador.SelectCommand = Cmd;
**********************************/
Conn = new OdbcConnection(connString);
Conn.Open();
OdbcCommand Cmd = new OdbcCommand(sel, Conn);
//OdbcCommand Dmd = new OdbcCommand(sel, Conn);
//Cmd.Parameters.AddWithValue("@_126", "Luisa");
//Cmd.Parameters.AddWithValue("@_21", "noexiste@nohay.com");
//Cmd.Parameters.AddWithValue("@_19", "55555555");
//Cmd.Parameters.AddWithValue("@_20", "programador");
//adaptador.InsertCommand = Dmd;
////Dmd.Dispose();
Cmd.ExecuteNonQuery();
}
catch (Exception ex)
{
error = (ex.Message);
}
finally
{
Conn.Close();
}

}


Marca el siguiente error:
Se detectó System.Data.Odbc.OdbcException
Message="ERROR [HY000] [Lotus][ODBC Lotus Notes]No INSERT/UPDATE/ALTER/CREATE INDEX/CREATE VIEW on view"
Source="NSQLV32.DLL"
ErrorCode=-2146232009
StackTrace:
en System.Data.Odbc.OdbcConnection.HandleEr… hrHandle, RetCode retcode)
en System.Data.Odbc.OdbcCommand.ExecuteRead… behavior, String method, Boolean needReader, Object[] methodArguments, SQL_API odbcApiMethod)
en System.Data.Odbc.OdbcCommand.ExecuteRead… behavior, String method, Boolean needReader)
en System.Data.Odbc.OdbcCommand.ExecuteNonQ…
en LOTUS.Form1.button2_Click(Object sender, EventArgs e) en D:RespaldosEjemplos Devexpress y c#LOTUSLOTUSForm1.cs:línea 82
InnerException:
Me dicen que es de permisos. ¿Alguna solución?
Muchas gracias y disculpen la molestia.

2
MS Access / Problema con el Docmd.Transfer
« en: Domingo 3 de Agosto de 2008, 01:10 »
Hola estamos desarrollando un sistema para crear reportes de antigüedad en Access, nosotros no sabemos utilizar el Access apenas nos estamos adaptando a su entorno y quisieramos ver si nos pueden ayudar con lo siguiente.
Creamos un boton con lo siguiente:
Set dbs = CurrentDb
On Error Resume Next
AuxTxtRuta = EscogeFichero(4)
AuxTxtRuta = Trim(AuxTxtRuta)
DoCmd.TransferSpreadsheet acImport, 8, "DELEGACIONES", AuxTxtRuta, True, "hoja1!A6:c12"
El problema esta en:
DoCmd.TransferSpreadsheet acImport, 8, "DELEGACIONES", AuxTxtRuta, True, "hoja1!A6:c12"
Si vuelvo a Utilizar este boton me duplica los datos de la tabla y lo que quiero es que unicamente los remplace, ¿Se puede?
Si quito la parte de "hoja1!A6:c12" si remplaza el archivo, pero lo que quiero es que los remplace utilizando ese rango.
Muchas gracias por cualquier ayuda que me puedan proporcionar.

3
VB .NET / Problema Con Line Input
« en: Domingo 30 de Marzo de 2008, 23:03 »
Imports System.IO
Public Class Form3
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim alg As Integer
        Dim blo As Integer
       
        alg = FreeFile()
        blo = FreeFile()


        If TextBox1.Text = "" Then
            MsgBox("no registro su nombre")
            TextBox1.Focus()
            TextBox1.Text = ""
        ElseIf TextBox2.Text = "" Then
            MsgBox("Ponga una contraseña")
            TextBox2.Focus()
        Else
          If OpenFileDialog1.FileName <> vbNullString Then
                FileOpen(alg, "c:\not.txt", OpenMode.Append)
                PrintLine(alg, TextBox1.Text)
                FileClose(alg)
                FileOpen(blo, "c:\carin.txt", OpenMode.Append)
                PrintLine(blo, TextBox2.Text)
                FileClose(blo)
                MsgBox("Archivo almacenado")
                Me.Hide()
                Form2.Show()

            End If

            End If


       

    End Sub

Hasta aquí voy bien
Quiero agregar el siguiente código para que no se repita la misma palabra en el texto not pero me origina un problema con las líneas vacías, ya que no se detiene hasta que revisa todas las líneas y me sigue mandando el mensaje de ya existe el usuario.



             FileOpen(alg, "c:\not.txt", OpenMode.Input)
            While Not EOF(alg)
                slinea = LineInput(alg)
                If slinea = slinea Then
                    slinea = LineInput(alg)
                    MsgBox("el usuario ya existe")
                    TextBox1.Focus()
                    TextBox1.Text = ""

                End If

            End While
            FileClose(alg)

¿Existe alguna forma de ignorar las líneas que no contengan texto?

4
VB .NET / Duplicar Forms
« en: Martes 18 de Marzo de 2008, 02:46 »
Mi problema es que no puedo lograr, que al apretar el botón se detenga en la quinta forma, me la duplica infinitamente

Public Class Form2
   
    Dim contador As Integer = 1

    Private Sub Panel1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Panel1.Click

        Dim mforma As New Form2()
        If contador < 5 Then
            mforma.Show()
         
        Else
            End

        End If
        contador = contador + 1



    End Sub

 
End Class

5
VB .NET / Problema Con El Boton Para Limpiar El Formulario
« en: Sábado 8 de Marzo de 2008, 06:18 »
Hola, apenas estoy iniciando con la programación en visual net, mi problema es que no he podido lograr que el botón para limpiar el formulario y se reinicie correctamente el programa, funcione. Les pido su ayuda, porfavor

Public Class Form1
    Dim hombre As String
    Dim mujer As String
    Dim pasado As String
    Dim ninio As String

    Private Sub SalirToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SalirToolStripMenuItem.Click
        End
    End Sub

    Private Sub CalcularToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Calcular.Click

        If RadioButton1.Checked = True Then
            hombre = (Val(TextBox1.Text) * 100)
            mujer = hombre - 100
            ninio = mujer * 0.9
            Label3.Text = ninio & "kg"
            If Val(TextBox2.Text) > Val(Label3.Text) Then
                pasado = Val(TextBox2.Text) - Val(Label3.Text)
                TextBox3.Text = "Su peso esta pasado por " & pasado & "Kg"
            ElseIf Val(TextBox2.Text) = Val(Label3.Text) Then
                TextBox3.Text = "Felicidades su peso es el ideal"
            Else
                pasado = Val(Label3.Text) - Val(TextBox2.Text)
                TextBox3.Text = "Le faltan: " & pasado & "Kg"

            End If
        End If

        If RadioButton2.Checked = True Then
            hombre = (Val(TextBox1.Text) * 100)
            mujer = hombre - 100
            ninio = mujer * 0.85
            Label3.Text = ninio & "kg"
            If Val(TextBox2.Text) > Val(Label3.Text) Then
                pasado = Val(TextBox2.Text) - Val(Label3.Text)
                TextBox3.Text = "Su peso esta pasado por " & pasado & "Kg"
            ElseIf Val(TextBox2.Text) = Val(Label3.Text) Then
                TextBox3.Text = "Felicidades su peso es el ideal"
            Else
                pasado = Val(Label3.Text) - Val(TextBox2.Text)
                TextBox3.Text = "Le faltan: " & pasado & "Kg"
            End If
        End If
        Calcular.Enabled = False
    End Sub


    Private Sub GroupBox3_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroupBox3.Enter
        If RadioButton1.Checked = False And RadioButton2.Checked = False Then
            Calcular.Enabled = False
            GroupBox3.Enabled = False
        End If
    End Sub



    Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
        If RadioButton1.Checked = True Then
            NCalculo.Enabled = True
            GroupBox2.Enabled = False
            GroupBox3.Enabled = True
            Calcular.Enabled = False
            TextBox1.Focus()
        End If
    End Sub

    Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged
        If RadioButton2.Checked = True Then
            NCalculo.Enabled = True
            GroupBox2.Enabled = False
            GroupBox3.Enabled = True
            Calcular.Enabled = False
            TextBox1.Focus()
        End If
    End Sub

    Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
        If e.KeyChar = Chr(13) Then
            If TextBox1.Text = "" Then
                MsgBox("no capturo nada", MsgBoxStyle.Critical, "E r r o r")
            ElseIf Not IsNumeric(TextBox1.Text) Then
                MsgBox("Capture estatura en metros", MsgBoxStyle.Critical, "E r r o r")
                TextBox1.Text = ""
            ElseIf Val(TextBox1.Text) > 2.3 Then
                MsgBox("Ha superado el limite permitido", MsgBoxStyle.Critical, "E r r o r")
                TextBox1.Text = ""
                TextBox1.Focus()
            ElseIf IsNumeric(TextBox1.Text) Then
                TextBox1.Enabled = False
                TextBox1.Text = TextBox1.Text & "m"
                TextBox2.Enabled = True
                TextBox2.Focus()
            End If
        End If
    End Sub

    Private Sub TextBox2_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox2.KeyPress
        If e.KeyChar = Chr(13) Then
            TextBox2.Enabled = False
            TextBox2.Text = TextBox2.Text & "Kg"
            Calcular.Enabled = True
           
        End If
    End Sub

    Private Sub AcercaDeToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AcercaDeToolStripMenuItem.Click
        Form2.Show()
    End Sub

    Private Sub NCalculo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NCalculo.Click
       




    End Sub
End Class

Páginas: [1]