|
21
|
Programación / Programación Visual Basic / Re: Crear un registro nuevo en una base de datos
|
en: 20 Diciembre 2006, 08:29 am
|
El error que me da lo adjunto como imagen al mensaje y al pulsar en depurar me lleva a esa línea de código. ¿Cómo puedo revisar los permisos de la base de datos? Permisos de escritura tiene porque yo puedo conectarme a ella a mano y escribir datos. Supongo que el control Ado tendra algun filtro de permisos tambien, como puedo darle permisos de escritura para ver si es eso? EDITADOHe comprobado los permisos del objeto ADO y tenia mode unknow y lo he puesto en readwrite y me sigue dando el mismo error. Tambien he probado a escribir con ado.recordset!campo y da exactamente el mismo error. Tambien he probado a intentar ejecutar la sentencia SQL "a pelo" pero no me deja, he leido por internet que se hacia: Adodc.recordset.execute("SQL") Pero a mi no me reconoce la opcion execute en el recordset, en los ejemplos que he leido en internet creaban el recordset desde codigo y yo he añadido el objeto en el formulario, supongo que no habra problema. Espero que podais ayudarme, gracias por leer. ¿Alguna otra sugerencia?Un saludo!
|
|
|
22
|
Programación / Programación Visual Basic / Crear un registro nuevo en una base de datos
|
en: 19 Diciembre 2006, 19:06 pm
|
AdoMensajes.Recordset.AddNew
AdoMensajes.Recordset.Fields("origen").Value = Usuario En esta parte de código me da un error en la segunda linea, ¿porqué? no puedo meter los datos así en la base de datos, me deja leer pero no escribir. Como puedo crear una nueva fila en la base de datos y guardar ciertas variables en sus campos? Un saludo!
|
|
|
23
|
Programación / Programación Visual Basic / Re: Mover varios FlexGrid al mismo tiempo
|
en: 5 Diciembre 2006, 15:28 pm
|
CeLaYa eso no me sirve porque el evento click de la celda lo uso para otra cosa, además quiero que se puedan ver todos siempre. DarkMouth tu opción era buena si funcionara te explico, cuando haces FlexGrid.Row = 58 se coloca en esa fila pero no desplaza las celdas hasta ver esa fila, así que como no se desplaza al elegir una fila ahora la duda es: ¿Cómo puedo mover el Flex Grid a un número de fila concreto? Gracias por la ayuda, un saludo!
|
|
|
24
|
Programación / Programación Visual Basic / Mover varios FlexGrid al mismo tiempo
|
en: 1 Diciembre 2006, 10:19 am
|
Estoy haciendo un programa en el que leo datos de 3 bases de datos diferentes y los presento en unos FlexGrid, cada uno de los FlexGrid tiene 500 filas, de tal forma que no entra en la pantalla, y lo que quiero es que cuando desplace con el scroll un FlexGrid hacia abajo o hacia arriba los otros dos lo hagan de la misma forma. Para tener todos alineados siempre. ¿Es posible?
Un saludo!
|
|
|
25
|
Programación / Programación Visual Basic / Re: Problema extraño con ADO
|
en: 27 Noviembre 2006, 17:58 pm
|
La conexion la hago así: AdoBD.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Ru taBD & ";Persist Security Info=False" LblEstado.Caption = "Conexión con la base de datos: OK" AdoBD.CursorLocation = adUseClient La búsqueda la hago así: 'Buscamos la tarjeta y sacamos los datos AdoBD.RecordSource = "Select * from Tarjetas where Número=" & ntarjeta AdoBD.Refresh txtimpresa.DataField = "Impreso" Ahí ya me aparecen los datos en txtimpresa, pero luego cuando los modifico y quiero que se guarden, meto este código: AdoBD.Recordset.Update AdoBD.Refresh Pero no actualiza la base de datos, yo creo que me estoy dejando alguna chorrada o no sé, había programado ya alguna vez más en vb contra bases de datos y no había tenido problemas, no sé que pasa pero algo me dejo. El tipo de cursor lo tengo como AdOpenKeySet Si yo abro la base de datos desde access me deja modificarla, de hecho tiene permisos de lectura/escritura/ejecución. Cuál puede ser el problema? Un saludo!!
|
|
|
26
|
Programación / Programación Visual Basic / Problema extraño con ADO
|
en: 27 Noviembre 2006, 17:09 pm
|
Tengo un extraño problema al usar ADO para conectar a una base de datos.
El caso es que me conecta bien, hago una consulta en sql y la hace bien, muestro los datos en un textbox asignandole la propiedad datafield al campo que quiero que me muestre.
Luego modifico ese campo en el textbox pulso un botón que tiene el evento Adodc1.recordset.update y al volver a buscar ese registro no me ha guardado los cambios que he hecho en el textbox.
Además si la busqueda no la hago de un registro sino de toda la tabla y voy moviendome por los registros, si modifico uno y pulso para moverme al siguiente registro me dice: operación cancelada en un msgbox.
Si ejecuto la opcion Adodc1.recordset.delete lo hace bien y me elimina el registro actual.
Entonces porqué no me actualiza? Qué hago mal?
Un saludo!
|
|
|
28
|
Foros Generales / Foro Libre / elhacker.net cuesta 44 705,00 $
|
en: 21 Agosto 2006, 19:57 pm
|
Aunque para algunos de nosotros elhacker.net no tiene precio, la página sootle.com lo valora en 44 705,00 $ una cifra considerable aunque comparandolo con ya.com por ejemplo que cuesta: 5 184 714,00 $ parece insignificante Aunque estoy seguro de que Alex nunca lo vendería, ni aunque le ofreciesen la cifra de ya.com (si repartes entre los colaboradores, puedes vender eh... ) Podeis ver las páginas más "caras" españolas aquí Saludos!! P.D. = Idea sacada de barrapunto.com
|
|
|
29
|
Programación / Programación Visual Basic / Re: Hacer ping a una maquina
|
en: 18 Agosto 2006, 16:35 pm
|
Al final la mejor solución ha sido la del módulo, he usado este, por si a alguien le interesa: Option Explicit
'Icmp constants converted from 'http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_pingstatus.asp
Private Const ICMP_SUCCESS As Long = 0 Private Const ICMP_STATUS_BUFFER_TO_SMALL = 11001 'Buffer Too Small Private Const ICMP_STATUS_DESTINATION_NET_UNREACH = 11002 'Destination Net Unreachable Private Const ICMP_STATUS_DESTINATION_HOST_UNREACH = 11003 'Destination Host Unreachable Private Const ICMP_STATUS_DESTINATION_PROTOCOL_UNREACH = 11004 'Destination Protocol Unreachable Private Const ICMP_STATUS_DESTINATION_PORT_UNREACH = 11005 'Destination Port Unreachable Private Const ICMP_STATUS_NO_RESOURCE = 11006 'No Resources Private Const ICMP_STATUS_BAD_OPTION = 11007 'Bad Option Private Const ICMP_STATUS_HARDWARE_ERROR = 11008 'Hardware Error Private Const ICMP_STATUS_LARGE_PACKET = 11009 'Packet Too Big Private Const ICMP_STATUS_REQUEST_TIMED_OUT = 11010 'Request Timed Out Private Const ICMP_STATUS_BAD_REQUEST = 11011 'Bad Request Private Const ICMP_STATUS_BAD_ROUTE = 11012 'Bad Route Private Const ICMP_STATUS_TTL_EXPIRED_TRANSIT = 11013 'TimeToLive Expired Transit Private Const ICMP_STATUS_TTL_EXPIRED_REASSEMBLY = 11014 'TimeToLive Expired Reassembly Private Const ICMP_STATUS_PARAMETER = 11015 'Parameter Problem Private Const ICMP_STATUS_SOURCE_QUENCH = 11016 'Source Quench Private Const ICMP_STATUS_OPTION_TOO_BIG = 11017 'Option Too Big Private Const ICMP_STATUS_BAD_DESTINATION = 11018 'Bad Destination Private Const ICMP_STATUS_NEGOTIATING_IPSEC = 11032 'Negotiating IPSEC Private Const ICMP_STATUS_GENERAL_FAILURE = 11050 'General Failure
Public Const WINSOCK_ERROR = "Windows Sockets not responding correctly." Public Const INADDR_NONE As Long = &HFFFFFFFF Public Const WSA_SUCCESS = 0 Public Const WS_VERSION_REQD As Long = &H101
'Clean up sockets. 'http://support.microsoft.com/default.aspx?scid=kb;EN-US;q154512
Private Declare Function WSACleanup Lib "WSOCK32.DLL" () As Long
'Open the socket connection. 'http://support.microsoft.com/default.aspx?scid=kb;EN-US;q154512 Private Declare Function WSAStartup Lib "WSOCK32.DLL" (ByVal wVersionRequired As Long, lpWSADATA As WSADATA) As Long
'Create a handle on which Internet Control Message Protocol (ICMP) requests can be issued. 'http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcesdkr/htm/_wcesdk_icmpcreatefile.asp Private Declare Function IcmpCreateFile Lib "icmp.dll" () As Long
'Convert a string that contains an (Ipv4) Internet Protocol dotted address into a correct address. 'http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/wsapiref_4esy.asp Private Declare Function inet_addr Lib "WSOCK32.DLL" (ByVal cp As String) As Long
'Close an Internet Control Message Protocol (ICMP) handle that IcmpCreateFile opens. 'http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcesdkr/htm/_wcesdk_icmpclosehandle.asp
Private Declare Function IcmpCloseHandle Lib "icmp.dll" (ByVal IcmpHandle As Long) As Long
'Information about the Windows Sockets implementation 'http://support.microsoft.com/default.aspx?scid=kb;EN-US;q154512 Private Type WSADATA wVersion As Integer wHighVersion As Integer szDescription(0 To 256) As Byte szSystemStatus(0 To 128) As Byte iMaxSockets As Long iMaxUDPDG As Long lpVendorInfo As Long End Type
'Send an Internet Control Message Protocol (ICMP) echo request, and then return one or more replies. 'http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcetcpip/htm/cerefIcmpSendEcho.asp Private Declare Function IcmpSendEcho Lib "icmp.dll" _ (ByVal IcmpHandle As Long, _ ByVal DestinationAddress As Long, _ ByVal RequestData As String, _ ByVal RequestSize As Long, _ ByVal RequestOptions As Long, _ ReplyBuffer As ICMP_ECHO_REPLY, _ ByVal ReplySize As Long, _ ByVal Timeout As Long) As Long 'This structure describes the options that will be included in the header of an IP packet. 'http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcetcpip/htm/cerefIP_OPTION_INFORMATION.asp Private Type IP_OPTION_INFORMATION Ttl As Byte Tos As Byte Flags As Byte OptionsSize As Byte OptionsData As Long End Type
'This structure describes the data that is returned in response to an echo request. 'http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcesdkr/htm/_wcesdk_icmp_echo_reply.asp Public Type ICMP_ECHO_REPLY address As Long Status As Long RoundTripTime As Long DataSize As Long Reserved As Integer ptrData As Long Options As IP_OPTION_INFORMATION Data As String * 250 End Type
'-- Ping a string representation of an IP address. ' -- Return a reply. ' -- Return long code. Public Function ping(sAddress As String, Reply As ICMP_ECHO_REPLY) As Long
Dim hIcmp As Long Dim lAddress As Long Dim lTimeOut As Long Dim StringToSend As String
'Short string of data to send StringToSend = "hello"
'ICMP (ping) timeout lTimeOut = 1000 'ms
'Convert string address to a long representation. lAddress = inet_addr(sAddress)
If (lAddress <> -1) And (lAddress <> 0) Then 'Create the handle for ICMP requests. hIcmp = IcmpCreateFile() If hIcmp Then 'Ping the destination IP address. Call IcmpSendEcho(hIcmp, lAddress, StringToSend, Len(StringToSend), 0, Reply, Len(Reply), lTimeOut)
'Reply status ping = Reply.Status 'Close the Icmp handle. IcmpCloseHandle hIcmp Else Debug.Print "failure opening icmp handle." ping = -1 End If Else ping = -1 End If
End Function
'Clean up the sockets. 'http://support.microsoft.com/default.aspx?scid=kb;EN-US;q154512 Public Sub SocketsCleanup() WSACleanup End Sub
'Get the sockets ready. 'http://support.microsoft.com/default.aspx?scid=kb;EN-US;q154512 Public Function SocketsInitialize() As Boolean
Dim WSAD As WSADATA
SocketsInitialize = WSAStartup(WS_VERSION_REQD, WSAD) = ICMP_SUCCESS
End Function
'Convert the ping response to a message that you can read easily from constants. 'For more information about these constants, visit the following Microsoft Web site: 'http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_pingstatus.asp
Public Function EvaluatePingResponse(PingResponse As Long) As String
Select Case PingResponse 'Success Case ICMP_SUCCESS: EvaluatePingResponse = "Success!" 'Some error occurred Case ICMP_STATUS_BUFFER_TO_SMALL: EvaluatePingResponse = "Buffer Too Small" Case ICMP_STATUS_DESTINATION_NET_UNREACH: EvaluatePingResponse = "Destination Net Unreachable" Case ICMP_STATUS_DESTINATION_HOST_UNREACH: EvaluatePingResponse = "Destination Host Unreachable" Case ICMP_STATUS_DESTINATION_PROTOCOL_UNREACH: EvaluatePingResponse = "Destination Protocol Unreachable" Case ICMP_STATUS_DESTINATION_PORT_UNREACH: EvaluatePingResponse = "Destination Port Unreachable" Case ICMP_STATUS_NO_RESOURCE: EvaluatePingResponse = "No Resources" Case ICMP_STATUS_BAD_OPTION: EvaluatePingResponse = "Bad Option" Case ICMP_STATUS_HARDWARE_ERROR: EvaluatePingResponse = "Hardware Error" Case ICMP_STATUS_LARGE_PACKET: EvaluatePingResponse = "Packet Too Big" Case ICMP_STATUS_REQUEST_TIMED_OUT: EvaluatePingResponse = "Request Timed Out" Case ICMP_STATUS_BAD_REQUEST: EvaluatePingResponse = "Bad Request" Case ICMP_STATUS_BAD_ROUTE: EvaluatePingResponse = "Bad Route" Case ICMP_STATUS_TTL_EXPIRED_TRANSIT: EvaluatePingResponse = "TimeToLive Expired Transit" Case ICMP_STATUS_TTL_EXPIRED_REASSEMBLY: EvaluatePingResponse = "TimeToLive Expired Reassembly" Case ICMP_STATUS_PARAMETER: EvaluatePingResponse = "Parameter Problem" Case ICMP_STATUS_SOURCE_QUENCH: EvaluatePingResponse = "Source Quench" Case ICMP_STATUS_OPTION_TOO_BIG: EvaluatePingResponse = "Option Too Big" Case ICMP_STATUS_BAD_DESTINATION: EvaluatePingResponse = "Bad Destination" Case ICMP_STATUS_NEGOTIATING_IPSEC: EvaluatePingResponse = "Negotiating IPSEC" Case ICMP_STATUS_GENERAL_FAILURE: EvaluatePingResponse = "General Failure" 'Unknown error occurred Case Else: EvaluatePingResponse = "Unknown Response" End Select
End Function
Saludos!!
|
|
|
30
|
Programación / Programación Visual Basic / Re: Hacer ping a una maquina
|
en: 18 Agosto 2006, 16:11 pm
|
No tengo problema por que rechacen solicitudes echo de icmp, es para tener controlados mis servidores linux desde un cliente windows, y los servidores tengo aceptadas las peticiones de protocolo icmp en local por iptables, así que por eso no tengo problemas, buscaré algún modulo así.
Gracias tio!
Saludos!!
|
|
|
|
|
|
|