|
Mostrar Temas
|
Páginas: [1] 2 3
|
1
|
Programación / Bases de Datos / [AYUDA] Optimizar Consulta
|
en: 26 Agosto 2013, 10:37 am
|
Buenas noches, tengo una consulta en MySQL que me está matando
les comento, anteriormente se corria el sistema en Visual Basic 2010 con una base de datos en ACCESS y funcionaba bien y rapido, el problema fue que ya no quisieron centralizado el sistema y se migro a un servidor online con MySQL
al hacer el cambio todo funciona perfectamente excepto esta consulta
select * from clientes where NoCliente not in (SELECT NoCliente from pagos where pagos.id In (select IdPago from Pagos_Detalle where Mes = 'Agosto' and año='2013')) order by Nombre ASC
Se tiene una tabla clientes una de pagos y otra de detalle de pagos
en clientes pues los clientes en pagos se establece fecha y monto y a que cliente corresponde el pago en pago_detalles se pone que meses se pagaron de servicios
esa consulta lo que hace es sacar los clientes DEUDORES, es decir los que no han pagado este mes
en MySQL, incluso corriendolo desde phpMyAdmin, o consola, (hice la prueba ya que pensé que era error del conector ODBC) esa consulta tarda
357.512 segundos (casi 6minutos!!!!) en access me lo hacía en segundos sin problemas
Alguna idea para optimizar la consulta y hacerla más rápida
De antemano Gracias.
|
|
|
2
|
Programación / .NET (C#, VB.NET, ASP) / [SOLUCIONADO] Handler vb net
|
en: 23 Septiembre 2011, 07:34 am
|
Buenas Tengo un sub el cual hace handler a 2 botones Private Sub Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click, Button2.Click como puedo saber cual de los dós botones llamó al sub?
|
|
|
3
|
Programación / .NET (C#, VB.NET, ASP) / Crear Objeto Desde Código
|
en: 21 Septiembre 2011, 05:10 am
|
Buenas Noches Actualmente tengo el código en VB NET de un programa que carga una página en un WebBrowser y en el sub de DocumentComplete realiza una función ahora quiero hacer el mismo proceso varias veces (actualmente lo que hago es abrir varias veces el programa) pero si lo hago necesito crear WebBrowsers de manera Dinámica esto lo logro sin problemas Dim wb1 As WebBrowser wb1 = New WebBrowser wb1.Navigate("http://www.google.com") se me ocurre crear varias instancias como sean necesarias de la manera wb1 wb2 wb3 wb4 etc.... pero como puedo manejar el evento DocumentComplete del webbrowser, seria la misma función para todos los navegadores algo así como Private Sub wb1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles wb1.DocumentCompleted
pero hacer que el Handles maneje wb1.DocumentCompleted, wb2.DocumentCompleted, wb3.DocumentCompleted algo así Private Sub wb1_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles wb1.DocumentCompleted, wb2.DocumentCompleted, wb3.DocumentCompleted
como hago para hacer esto dinámicamente Saludos =D
|
|
|
4
|
Programación / .NET (C#, VB.NET, ASP) / Codigos De Barra
|
en: 28 Agosto 2011, 09:31 am
|
Buenas
Estoy haciendo un programa que maneja artículos, es como un punto de venta, el problema es que hay artículos que no tienen código de barras así que se le genera un en el programa
estoy intentando imprimirlos, encontre una aplicacion en vb6 pero no la he logrado traducir
lo que ahora hago es llenar una hoja de excel con los datos de los artículos usando la fuente CCode39 o AutomationID (es TreuType) pero el lector no las lee ya que genera muy juntas y chicas las barras
alguna manera de generarlas en vb net?
saludos y de antemano gracias
|
|
|
5
|
Programación / .NET (C#, VB.NET, ASP) / Picturbox.drawidth en vb net
|
en: 28 Agosto 2011, 09:26 am
|
Estoy intentando pasar este codigo de vb6 a .net pero me pierdo en el PICTUREBOX alguna idea? lo que hace es generar un código de barras Private Sub GeraCodBar39(ByVal x As String, ByVal Sclr As Integer) Dim pic As PictureBox Dim bc4(0 To 20) As String Dim barchar As String Dim barcolor As String Dim bs As Single Dim bwn As Single Dim ac As Integer Dim s As Integer Dim bct As Integer Dim bcl As Integer ac = 1 pic.Image = Nothing bc4(ac - 1) = "121121211" For bct = 1 To Len(x) barchar = Mid(x, bct, 1) If barchar = " " Then barchar = "SP" For s = 0 To UBound(zz1) If UCase(barchar) = zz1(s) Then bc4(ac) = zz2(s) ac = ac + 1 Exit For End If Next s Next bct bc4(ac) = "121121211" bs = 200 pic.DrawWidth = 1 For bct = 0 To ac x = bc4(bct) barcolor = Color.Black.ToString For s = 1 To Len(x) bwn = (Val(Mid(x, s, 1))) * Sclr For bcl = 1 To bwn pic.Line (bs + bcl, 100)-Step(0, 500), barcolor drawli() Next bcl If barcolor = Color.Black.ToString Then barcolor = Color.White.ToString Else barcolor = Color.Black.ToString bs = bs + bwn Next s For bcl = 1 To Sclr pic.Line (bs + bcl, 100)-Step(0, 500), vbWhite Next bcl bs = bs + bcl Next bct pic.FontSize = 16 : pic.CurrentX = 200 : pic.CurrentY = 600 : pic.Print(UCase(txtdata)) End Sub los errores me los da en pic.FontSize pic.CurrentX pic.CurrentY pic.Print(UCase(txtdata) pic.DrawWidth lei que tiene que ser con PEN y Graphics pero me pierdo
|
|
|
6
|
Programación / .NET (C#, VB.NET, ASP) / vb net SELECT de Acces no funciona
|
en: 21 Agosto 2011, 00:25 am
|
Buenas Tengo un pequeño problema que no logro resolver si ejecuto este SQL en ACCESS funciona perfectamente y me devuelve el ID, pero si la ejecuto en VB NET me dice que no hay registros select id from medicamentos where codigo='2121 1'; ya lo intente tambien como select id from medicamentos where codigo like '2121 1'; si ejecuto la consulta en ACCESS funciona tendrá algo que ver que el campo sea de tipo TEXTO? aqui está el como lo hago en vb net el codigotxt.text contiene "2121" Dim cn As OleDbConnection Dim cmd As OleDbCommand Dim dr As OleDbDataReader
Try cn = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & CurDir() & "\base.accdb;") cn.Open() cmd = New OleDbCommand("select id from articulos where codigo like '" & CodigoTxt.Text & " 1'", cn) dr = cmd.ExecuteReader MsgBox(dr("id")) dr.close() cn.close() Catch ex As Exception MsgBox(ex.Message) End Try en el vb net me dice el exception "No Data Exist for the Row/column." Alguna idea? de antemano GRACIAS
|
|
|
7
|
Programación / .NET (C#, VB.NET, ASP) / Imprimir Formulario Mayor a la pantalla vb net
|
en: 19 Julio 2011, 08:21 am
|
Buenas Tengo un pequeño problema, estoy intentando imprimir un formato en vb net (VS2010) no puedo hacer el form mas grande a 768 por que es el límite que me pone mi resolución así que agregué un picturebox del tamaño que necesito e hice el form autoscroll = true para agregar los datos del formato que me faltaban Pero al momento de imprimirlo solo sale la parte del form que se ve, tanto con PRINTFORM como con PRINTDOCUMENT Con PrintForm Uso este código PrintForm1.PrinterSettings.DefaultPageSettings.Margins.Top = 0 PrintForm1.PrinterSettings.DefaultPageSettings.Margins.Left = 0 PrintForm1.PrinterSettings.DefaultPageSettings.Margins.Right = 0 PrintForm1.PrinterSettings.DefaultPageSettings.Margins.Bottom = 0 PrintForm1.PrinterSettings.DefaultPageSettings.Landscape = False PrintForm1.Print(Me, PowerPacks.Printing.PrintForm.PrintOption.Scrollable) con el printdocument es un poco más largo EN EL EVENTO CLICK Dim printdoc As PrintDocument printdoc = New PrintDocument AddHandler printdoc.PrintPage, AddressOf OnPrintPage printdoc.DefaultPageSettings.Margins.Top = 0 printdoc.DefaultPageSettings.Margins.Left = 0 printdoc.DefaultPageSettings.Margins.Bottom = 0 printdoc.Print() una CLASE Public Class Win32APICall
Public Const DIB_RGB_COLORS = 0 Public Const BI_RGB = 0 Public Const WHITENESS = 16711778
<DllImport("user32.dll", EntryPoint:="PrintWindow", _ SetLastError:=True, CharSet:=CharSet.Unicode, _ ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _ Public Shared Function PrintWindow(ByVal hWnd As IntPtr, ByVal hDC As IntPtr, ByVal dwFlags As Integer) As UInt32 End Function
<StructLayout(LayoutKind.Sequential, pack:=8, CharSet:=CharSet.Auto)> _ Structure BITMAPINFOHEADER Dim biSize As Int32 Dim biWidth As Int32 Dim biHeight As Int32 Dim biPlanes As Int16 Dim biBitCount As Int16 Dim biCompression As Int32 Dim biSizeImage As Int32 Dim biXPelsPerMeter As Int32 Dim biYPelsPerMeter As Int32 Dim biClrUsed As Int32 Dim biClrImportant As Int32 End Structure
<DllImport("gdi32.dll", EntryPoint:="CreateDIBSection", _ SetLastError:=True, CharSet:=CharSet.Unicode, _ ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _ Public Shared Function CreateDIBSection(ByVal hdc As IntPtr, ByRef pbmi As BITMAPINFOHEADER, _ ByVal iUsage As Int32, ByVal ppvBits As IntPtr, ByVal hSection As IntPtr, _ ByVal dwOffset As Int32) As IntPtr End Function
<DllImport("gdi32.dll", EntryPoint:="PatBlt", _ SetLastError:=True, CharSet:=CharSet.Unicode, _ ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _ Public Shared Function PatBlt(ByVal hDC As IntPtr, ByVal nXLeft As Int32, _ ByVal nYLeft As Int32, ByVal nWidth As Int32, ByVal nHeight As Int32, _ ByVal dwRop As Int32) As Boolean End Function
<DllImport("gdi32.dll", EntryPoint:="SelectObject", _ SetLastError:=True, CharSet:=CharSet.Unicode, _ ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _ Public Shared Function SelectObject(ByVal hDC As IntPtr, ByVal hObj As IntPtr) As IntPtr End Function
<DllImport("GDI32.dll", EntryPoint:="CreateCompatibleDC", SetLastError:=True, CharSet:=CharSet.Unicode, _ ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _ Public Shared Function CreateCompatibleDC(ByVal hRefDC As IntPtr) As IntPtr End Function
<DllImport("GDI32.dll", EntryPoint:="DeleteDC", SetLastError:=True, CharSet:=CharSet.Unicode, _ ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _ Public Shared Function DeleteDC(ByVal hDC As IntPtr) As Boolean End Function
<DllImport("GDI32.dll", EntryPoint:="DeleteObject", SetLastError:=True, CharSet:=CharSet.Unicode, _ ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _ Public Shared Function DeleteObject(ByVal hObj As IntPtr) As Boolean End Function
<DllImport("User32.dll", EntryPoint:="ReleaseDC", SetLastError:=True, CharSet:=CharSet.Unicode, _ ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _ Public Shared Function ReleaseDC(ByVal hWnd As IntPtr, ByVal hDC As IntPtr) As Boolean End Function
<DllImport("User32.dll", EntryPoint:="GetDC", SetLastError:=True, CharSet:=CharSet.Unicode, _ ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _ Public Shared Function GetDC(ByVal hWnd As IntPtr) As IntPtr End Function
End Class un SUB Private Sub OnPrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Dim hwndForm As IntPtr hwndForm = Me.Handle
Dim hdcDIBSection As IntPtr Dim hdcRef As IntPtr Dim hbmDIBSection As IntPtr Dim hbmDIBSectionOld As IntPtr Dim BMPheader As Win32APICall.BITMAPINFOHEADER
hdcRef = Win32APICall.GetDC(IntPtr.Zero) hdcDIBSection = Win32APICall.CreateCompatibleDC(hdcRef) Win32APICall.ReleaseDC(IntPtr.Zero, hdcRef)
BMPheader.biBitCount = 24 BMPheader.biClrImportant = 0 BMPheader.biClrUsed = 0 BMPheader.biCompression = Win32APICall.BI_RGB BMPheader.biSize = 40 BMPheader.biHeight = 964 BMPheader.biPlanes = 1 BMPheader.biSizeImage = 0 BMPheader.biWidth = Me.Width BMPheader.biXPelsPerMeter = 0 BMPheader.biYPelsPerMeter = 0
hbmDIBSection = Win32APICall.CreateDIBSection(hdcDIBSection, BMPheader, Win32APICall.DIB_RGB_COLORS, _ IntPtr.Zero, IntPtr.Zero, 0)
hbmDIBSectionOld = Win32APICall.SelectObject(hdcDIBSection, hbmDIBSection) Win32APICall.PatBlt(hdcDIBSection, 0, 0, Me.Width, 964, Win32APICall.WHITENESS) Win32APICall.PrintWindow(hwndForm, hdcDIBSection, 0) Win32APICall.SelectObject(hdcDIBSection, hbmDIBSectionOld)
Dim imageFrm As Bitmap imageFrm = Image.FromHbitmap(hbmDIBSection) e.Graphics.DrawImage(imageFrm, 0, 0)
Win32APICall.DeleteDC(hdcDIBSection) Win32APICall.DeleteObject(hbmDIBSection) End Sub y las declaraciones Generales Imports System.Drawing.Printing Imports System.Drawing.Graphics Imports System.Drawing.Imaging Imports System.Runtime.InteropServices pero ninguna de las dos me imprime el formulario completo necesito imprimir el formato que mide 964 pixeles de largo es CASI una hoja carta alguna sugerencia?
|
|
|
8
|
Programación / Programación C/C++ / Notación Polaca Inversa
|
en: 15 Septiembre 2010, 07:37 am
|
Buenas! he estado trabajando en este programa que convierte una cadena en notación Infija a notación postfija pero me dá problemas el PUSH!, en linux medice VIOLACIÓN DE SEGMENTO y en windows solo se cuelga el programa se que son los push, xq si pongo solo números me lo dá (tmb si comento los PUSH) alguna idea?, que estóy haciendo mal gracias #include <stdio.h> #include <stdlib.h> #include <string.h>
int push(char *pila, char **tope, int n, char dato) { if(pila+n==*tope) return 1; else { **tope = dato; (*tope)++; return 0; } }
int pop(char *pila, char **tope, char *dato) { if(pila==*tope) return 1; else { (*tope)--; *dato= **tope; return 0; } }
int tipoparentesis(char valor) { switch (valor) { case '(' : return 1; case ')' : return 1; case '[' : return 2; case ']' : return 2; case '{' : return 3; case '}' : return 3; default: return 0; } } int presedencia(char dato, char valor) { int x, y, as; switch (dato) { case '+' : x=4; as=1; break; case '-' : x=4; as=1; break; case '*' : x=3; as=1; break; case '/' : x=3; as=1; break; case '^' : x=2; as=2; break; default: x=0; } switch (valor) { case '+' : y=4; break; case '-' : y=4; break; case '*' : y=3; break; case '/' : y=3; break; case '^' : y=2; break; } if( (x <= y && as==1) || (x >= y && as==2) ) { return 1; } else { return 0; } }
main() { char entrada[50], salida[50],temporal[2]; char *pila, *tope, *dato, val; int i, tam, tam1; pila = (char *)malloc(sizeof(char)*50); tope = pila; printf("Dame tu cadena en infija\n"); scanf("%s",entrada); tam = strlen(entrada); for(i=0; i<tam; i++) { val = entrada[i]; if (val == '+' || val == '-' || val == '*' || val == '/' || val == '^') { nuevo: if((pop(pila,&tope,dato))== 0) { if (presedencia(*dato,val) == 1) { temporal[0]=*dato; strcat(salida,temporal); goto nuevo; } else { push(pila,&tope,12,*dato); push(pila,&tope,12,val); } } else { push(pila,&tope,12,val); } } else if(val == '(' || val == '[' || val == '{') { push(pila,&tope,tam,val); } else if ((val == ')') || (val == ']') || (val == '}')) { again: if(tipoparentesis(val) != tipoparentesis(*dato)) goto error; if((pop(pila,&tope,dato)) != 0) goto error; if( (*dato == '(' && val == ')') || (*dato == '[' && val == ']') || (*dato == '{' && val == '}') ) { } else { temporal[0]=val; strcat(salida,temporal); goto again; } } else { temporal[0]= val; strcat(salida,temporal); } } while(*tope != *pila) { if((pop(pila,&tope,dato)) == 0) { if( *dato == '(' || *dato == '[' || *dato == '{') goto error; temporal[0]=*dato; strcat(salida,temporal); } } printf("Tu cadena en postfija es:"); printf("%s\n",salida); system("pause"); return 0; error: printf("Tu ecuación está mal formada"); return 1; }
|
|
|
9
|
Programación / Programación Visual Basic / Ayuda!!! Winsock Transfiere a 8Bytes Por Segundo
|
en: 8 Octubre 2009, 10:58 am
|
Pues Estoy Haciendo Un Programa Cliente/Servidor Que Envia Una Imagen Por WinSock (uso CSocketMaster) pero el problema que tengo es que ENVIA A 8bytes por SEGUNDO!!!!!!! alguien me puede ayudar y decirme xq? aqui dejo el codigo, El que envia tiene un MODULO para convertir Imagen BMP a JPG pero ese no lo adjunto el codigo, xq de ahi funciona perfecto ya intente COPILANDOLOS y DESDE VB6, La conexion la hago el que ENVIA desde una Maquina Virtual, de hecho intenté en la misma maquina, es decir SIN LA VIRUTAL y me transfiere = a 8Bytes por segundo, de hecho despues de intentarlo varias veces AHORA ME TRANSFIERE a 4bytesporsegundo tmb lo intente TODO (enviar y recibir) desde la maquina virtual y el mismor resultado DEMASIADO LENTO!! alguna idea? Recibe: Dim WithEvents WS1 As CSocketMaster Dim Imagen() As Byte Dim Flag As Boolean Dim Tamaño As Long Dim lBytes As Long
Private Sub Command1_Click() WS1.CloseSck WS1.Listen End Sub
Private Sub Form_Load()
Set WS1 = New CSocketMaster WS1.LocalPort = 6969 WS1.CloseSck WS1.Listen End Sub
Private Sub Timer1_Timer() Label1.Caption = WS1.State End Sub
Private Sub WS1_ConnectionRequest(ByVal requestID As Long) WS1.CloseSck WS1.Accept requestID End Sub
Private Sub WS1_DataArrival(ByVal bytesTotal As Long)
If Flag = False Then WS1.GetData datos, vbLong Tamaño = datos Open "C:\Captura.jpg" For Binary Access Write As #1 Flag = True End If If Flag Then lBytes = lBytes + bytesTotal Label2.Caption = lBytes WS1.GetData Imagen Put #1, , Imagen If lBytes >= Tamaño Then Close #1 Flag = False Image1.Picture = LoadPicture("C:\Captura.jpg") lBytes = 0 End If End If End Sub
Envia: Dim WithEvents WS1 As CSocketMaster Dim Imagen() As Byte Private Sub Form_Load() Set WS1 = New CSocketMaster WS1.RemoteHost = "HACK01" WS1.RemotePort = 6969 WS1.CloseSck WS1.Connect End Sub
Private Sub Timer1_Timer() Label1.Caption = WS1.State End Sub
Private Sub Timer2_Timer() Set Picture1.Picture = CaptureScreen() SavePicture Picture1.Picture, App.Path & "\TmpBmp.bmp" BMPtoJPG App.Path & "\TmpBmp.bmp", App.Path & "\TmpPic.jpg" If WS1.State = sckConnected Then Enviar_Imagen End If End Sub
Private Sub WS1_CloseSck() WS1.CloseSck WS1.Connect End Sub
Private Function Enviar_Imagen() WS1.SendData FileLen(App.Path & "\TmpPic.jpg") Open App.Path & "\TmpPic.jpg" For Binary Access Read As #1 Get #1, , Imagen Close #1 WS1.SendData Imagen
End Function
|
|
|
10
|
Programación / Programación Visual Basic / Grabar Video De Pantalla
|
en: 29 Septiembre 2009, 23:39 pm
|
Pues estoy intentando crear una aplicacion para poder cuidar a mis trabajadores
asi que lo que necesito es poder grabar lo que se ve la pantalla en video
lo que se me ocurrio hacer primero es
un programa que toma una captura de pantalla y la guarda en jpg y luego la envia a otra compu por WINSOCK y la que la recibe la ve en un picture box
eso es facil y sencillo si lo hago cada 3 segundos jeje
el problema viene cuando quiero guardar lo que hicieron si guardara las imagenes pues seria dificl seguir la secuencia jeje
como las capturas las hace en mala calidad cada imagen pesa 5kb osea que no es problema
alguna idea de como grabar video, AUNKE NO LO TRASMITA, solo qu elo guarde y despues yo los saco, si quiero ver lo que hacen en el momento con las imagenes es mas que suficiente
gracias
|
|
|
|
|
|
|