|
how to disconnect my account from mysql server using vb.net 2003 code?
|
|
|
|
|
That depends on what you mean by "disconnect my account". What you've asked doesn't make any sense.
|
|
|
|
|
Hi,
I have one user table in sqlexpress
UserTable
User_ID
User_name
Password
Last_Name
First_Name
last_update
Login form in vb.net.
I can validate user information on login but what I want to do is to have the user to change his/her password the very first time he uses this password.
How can I achieve this solution?
I like to have some sample code
Thanks for your guidance in advance..
PLEASE HELP
|
|
|
|
|
You have given us fairly limited info here, but one option would be this:
When you create a new user, do not put a date in the last_update field (since you are creating, not updating the user).
Then, in the login form, check for NULL in the last_update field. If it's NULL, trigger the password update screen, setting the new password, and inserting a date into the last_update field.
Done!!
|
|
|
|
|
Better yet, add a field to the table: PasswordExpired
I think you can figure out what to do with it.
|
|
|
|
|
Dave Kreskowiak wrote: I think you can figure out what to do with it.
Wouldn't put my money on it
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
I wouldn't either. Seriously, I weep for the future of software development.
|
|
|
|
|
Good evening everyone,
in my project I use a 'frames' class which controls the different images of a film. The frames are stored in a generic list, and every time the index changes I raise an own event called 'FrameChanged'. I might have to tell that it's my first attempt to use selfmade EventArgs... and over and over again I run into a 'TargetParameterCountException' without finding an idea why?
Maybe someone of you experienced guys is able to support me with some advice? Here's what I do:
The event is defined in the frames class with
Public Shared Event FrameChanged(ByVal sender As Object, ByVal e As FrameChangedEventArgs) .
The event args are:
Public Class FrameChangedEventArgs
Inherits EventArgs
Public Total As Integer
Public Done As Integer
Public Index As Integer
Public File As String
Public Message As String
Public Sub New(ByVal TotalFrames As Integer, ByVal FramesSoFar As Integer, ByVal Ind As Integer, ByVal filename As String, ByVal msg As String)
MyBase.New()
Total = TotalFrames
Done = FramesSoFar
Index = Ind
File = filename
Message = msg
End Sub
End Class Then the event is raised in the 'Set' part of the index property:
RaiseEvent FrameChanged(Nothing, New FrameChangedEventArgs(Max, value, value, File, String.Empty))
In a form I first define a listener like this:
AddHandler clsFrames.FrameChanged, AddressOf OnFrameChange 'Listener!
And, finally, this is the event handler:
Public Sub OnFrameChange(ByVal sender As Object, ByVal e As FrameChangedEventArgs)
Try
If Me.InvokeRequired Then
Dim dlg As New UpdateCounterDelegate(AddressOf OnFrameChange)
----> Me.Invoke(dlg, New FrameChangedEventArgs(e.Total, e.Done, e.Index, e.File, e.Message))
Else
UpdateGUI(e.Total, e.Done, e.Index, e.File, e.Message)
End If
Catch ex As Exception
MsgBox("Error in the FrameChanged-Event!")
End Try
End Sub
When debugging I find that the error occurs in the marked line above. I'm starting to doubt that I'm able to count to five... Or what else is wrong with my code where this ParameterCount problem might result from?
Thank you in advance,
Michael
p.s. Trying to use 'BeginInvoke' instead results in the same error thrown at the end of the sub, before updating the GUI.
|
|
|
|
|
The parameter mismatch has nothing to do with the number of arguments in the FrameChangedEventArgs constructor. The compiler would catch that and wouldn't even let you build the executable.
The problem is UpdateCounterDelegate. You're passing one parameter to an UpdateCounterDelegate (the FrameChangedEventArgs object). What does that delegate require?
If it's the usual "object as Sender, e as ___EventArgs" format, then you need to add "sender" as an extra parameter in the invoke, before the FrameChangedEventArgs.
|
|
|
|
|
Thank you, Ian, for your constructive support. It works fine now !
Somehow I had assumed that "dlg" would be the sender, so I was sure to have passed sender as well as the EventArgs.
Regards
Michael
|
|
|
|
|
Hi Michael,
Control.Invoke takes TWO parameters: a delegate and a parameters array.
(when no delegate parameters are required, there is a single-parameter overload too).
Examples are plenty, see here[^] for instance.
BTW: you really should find that in no time by looking at the documentation[^].
PS: and you'll have the opportunity to use curly brackets in VB!
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Thank you, Luc, for your answer. It's working fine now after inserting the form ('Me') as the sender !
My error was to assume that the delegate itself would function as sender i.e. the first parameter. This error occurred despite looking at samples and the documentation.
Regards
Michael
|
|
|
|
|
i am in need of ID3 decision tree code in vb.net or java for my project.
send me the link to sdeepan_cse@yahoo.com
|
|
|
|
|
Write it yourself. Noone here is just going to hand over their hard work so you get an easy pass at your own job. If you want examples, what's so hard about typing "ID3 decision tree VB.NET" into Google?
|
|
|
|
|
i already tried google search for ID3 decision tree source code in vb.net.
but i did not get any link which require for me.
|
|
|
|
|
Well, it looks like the only source code [^]you're going to get is in C#. You'll have to convert whatever code you find to VB.NET. Again, noone is just going to hand over their work to you.
|
|
|
|
|
Now you have published your email address I bet you get lots of 'code'.
You are on the wrong site, try rentacoder.com and pay for it - or admit you will fail your course/shouldn't have taken the job (delete as appropriate)
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
Hello,
Wow, it's been 1 week, yes 1 week before i request any help about this nightmare.
It's seems almost impossible to have a simple VB code for what i want.
My goal :
- Query 30 printers with SNMP so i can retrieve their Page Counter.
I made a batch for that with the util "snmpget". So simple, but i would like to perform it all in Excel so it would be better to transfer it in VB.
I tried so many things, third party DLL, API, Winsock, WMI, SNMP... Some codes works but not everything, others simply don't, well...
I would like to work with this bunch of code :
strTargetSnmpDevice = "192.168.1.20"
Set objWmiLocator = CreateObject("WbemScripting.SWbemLocator")
Set objWmiServices = objWmiLocator.ConnectServer("", "root\snmp\localhost")
Set objWmiNamedValueSet = CreateObject("WbemScripting.SWbemNamedValueSet")
objWmiNamedValueSet.Add "AgentAddress", strTargetSnmpDevice
objWmiNamedValueSet.Add "AgentReadCommunityName", "public"
Set colIfTable = objWmiServices.InstancesOf("SNMP_RFC1213_MIB_ifTable", , _
objWmiNamedValueSet)
For Each objInterface In colIfTable
WScript.Echo "ifIndex [Key]: " & objInterface.ifIndex & vbCrLf & _
" ifAdminStatus: " & objInterface.ifAdminStatus & vbCrLf & _
" ifDescr: " & objInterface.ifDescr & vbCrLf & _
" ifInDiscards: " & objInterface.ifInDiscards & vbCrLf & _
" ifInErrors: " & objInterface.ifInErrors & vbCrLf & _
" ifInNUcastPkts: " & objInterface.ifInNUcastPkts & vbCrLf & _
" ifInOctets: " & objInterface.ifInOctets & vbCrLf & _
" ifInUcastPkts: " & objInterface.ifInUcastPkts & vbCrLf & _
" ifInUnknownProtos: " & objInterface.ifInUnknownProtos & vbCrLf & _
" ifLastChange: " & objInterface.ifLastChange & vbCrLf & _
" ifMtu: " & objInterface.ifMtu & vbCrLf & _
" ifOperStatus: " & objInterface.ifOperStatus & vbCrLf & _
" ifOutDiscards: " & objInterface.ifOutDiscards & vbCrLf & _
" ifOutErrors: " & objInterface.ifOutErrors & vbCrLf & _
" ifOutNUcastPkts: " & objInterface.ifOutNUcastPkts & vbCrLf & _
" ifOutOctets: " & objInterface.ifOutOctets & vbCrLf & _
" ifOutQLen: " & objInterface.ifOutQLen & vbCrLf & _
" ifOutUcastPkts: " & objInterface.ifOutUcastPkts & vbCrLf & _
" ifPhysAddress: " & objInterface.ifPhysAddress & vbCrLf & _
" ifSpecific: " & objInterface.ifSpecific & vbCrLf & _
" ifSpeed: " & objInterface.ifSpeed & vbCrLf & _
" ifType: " & objInterface.ifType & vbCrLf
Next
I have 1 question :
- Set colIfTable = objWmiServices.InstancesOf("SNMP_RFC1213_MIB_ifTable", , _
objWmiNamedValueSet)
This line is driving me crazy. I understand it retrieves all IP configuration.
Straight from the RFC 1759 or the Printer-mib, i want to have THIS oid ! (1.3.6.1.2.1.43.10.2.1.4).
I checked, it's in the "prtMarkerEntry" class.
But how the hell i can specify it ?
Whenever i put Set colIfTable = objWmiServices.InstancesOf("SNMP_RFC1759_MIB_prtmarkerentry", , _
objWmiNamedValueSet)
i have then an error on the "FOR LOOP". ColIfTable is empty. How all this work ?
I read so many things, i'm lost. Do i need to insert any MIB into the WMI repositery ? The famous mof files and all that ?
Thanks in advance everybody.
|
|
|
|
|
From my very limited research on the topic (good luck finding a "simple" example for this!), it would appear that you're missing the MIB data that describes to the SNMP Provider how to translate between SNMP data and WMI objects.
This would be done using an SNMP information module file and running it through the SMI2SMIR compiler. You would either need to find an SNMP module file for the SNMP output of the printer in question, or write one yourself. Or, better still, if the manufacturer of the printer supplies a MIB file for it, you'd need to import that MIB into the SMIR (SNMP Module Information Repository) by running smi2smir /a <MIB file> .
|
|
|
|
|
Hello all,
I have a DOS based program I use to collect sales data from cash registers. I need to close this DOS window in a VBscript I would like to write.
When manually closing out of the window, the program that is open wants the user to type 'y' to quit the program before it will allow the DOS window to close.
Can someone give me some code to
1) Invoke the close method on the DOS window
2) Send the 'y' key to the DOS window?
This is operating on Win95.
|
|
|
|
|
If you use the WScript.Shell's Exec method[^] to launch your DOS app, you get an object back that lets you get at the StanardIn and StandardOut streams, giving you the ability to send keyboard input to the DOS app.
|
|
|
|
|
Thanks Dave!
That works perfectly...
However the app in question (command line) starts when windows starts. No big deal there, I could make a script to start the prog instead of calling the prog .exe
I actually would like to close the command line program via a scheduler at a certain time of day. So the potential issue here is, if I use the script to start the program, it will be running and running for 23+ hours before it sends the command to quit.
Ideally I would like to come up with a way to run a script from the scheduler that would close the command line window, then send the 'y' key to respond to the program.
Any ideas?
|
|
|
|
|
Can't be done from VBScript. After the DOS window is created, VBScript has no way of getting at the Standard I/O streams. You'd have to write a custom component, exposed through COM, in C++, C#, or VB.NET, to do what you want.
|
|
|
|
|
This might be over complicated but ...
What if you create a "watchdog" program that launches the child DOS window. Then the watchdog would be able to close the child window. You could even build into the watchdog the logic to automatically close the child at a predetermined time.
Otherwise, is it possible to re-write it as a VB.net console application ? You would have alot more control over the application.
|
|
|
|
|
I am getting an error: Before I show the error I will explain a sec.
32-bit OS works fine
64-bit OS Error.
The error is specifically on the form that has the Crystal reports module on it.
Crystal Reports Runtime library is installed.
Any suggestions on the Error? I have been searching the net without success.
System.InvalidOperationException: An error occurred creating the form. See Exception.InnerException for details. The error is: Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)) ---> System.Runtime.InteropServices.COMException (0x80040154): Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
at System.Windows.Forms.UnsafeNativeMethods.CoCreateInstance(Guid& clsid, Object punkOuter, Int32 context, Guid& iid)
at System.Windows.Forms.AxHost.CreateWithoutLicense(Guid clsid)
at System.Windows.Forms.AxHost.CreateWithLicense(String license, Guid clsid)
at System.Windows.Forms.AxHost.CreateInstanceCore(Guid clsid)
at System.Windows.Forms.AxHost.CreateInstance()
at System.Windows.Forms.AxHost.GetOcxCreate()
at System.Windows.Forms.AxHost.TransitionUpTo(Int32 state)
at System.Windows.Forms.AxHost.CreateHandle()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.AxHost.EndInit()
at BondingBroker.frmViewWIPAnalysis.InitializeComponent()
--- End of inner exception stack trace ---
at BondingBroker.My.MyProject.MyForms.Create__Instance__[T](T Instance)
at BondingBroker.frmWIPAnalysis.WIPAnalysisToolStripMenuItem_Click(Object sender, EventArgs e)
at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.WndProc(Message& m)
at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3082 (QFE.050727-3000)
CodeBase: file:----------------------------------------
BondingBroker
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:----------------------------------------
Microsoft.VisualBasic
Assembly Version: 8.0.0.0
Win32 Version: 8.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:----------------------------------------
System.Runtime.Remoting
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:----------------------------------------
System.Data
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:----------------------------------------
System.Xml
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3082 (QFE.050727-3000)
CodeBase: file:----------------------------------------
System.Data.DataSetExtensions
Assembly Version: 3.5.0.0
Win32 Version: 3.5.30729.1 built by: SP
CodeBase: file:----------------------------------------
System.Core
Assembly Version: 3.5.0.0
Win32 Version: 3.5.30729.1 built by: SP
CodeBase: file:----------------------------------------
Microsoft.VisualBasic.PowerPacks.Vs
Assembly Version: 9.0.0.0
Win32 Version: 9.0.30729.1
CodeBase: file:----------------------------------------
PeerAssist_BondingInformation
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:----------------------------------------
System.Configuration
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:----------------------------------------
System.Transactions
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:----------------------------------------
System.EnterpriseServices
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:----------------------------------------
CrystalDecisions.CrystalReports.Engine
Assembly Version: 10.5.3700.0
Win32 Version: 10.5.0.1943
CodeBase: file:----------------------------------------
CrystalDecisions.Shared
Assembly Version: 10.5.3700.0
Win32 Version: 10.5.0.1943
CodeBase: file:----------------------------------------
CrystalDecisions.ReportAppServer.CommLayer
Assembly Version: 10.5.3700.0
Win32 Version: 10.5.0.1943
CodeBase: file:----------------------------------------
CrystalDecisions.ReportAppServer.DataSetConversion
Assembly Version: 10.5.3700.0
Win32 Version: 10.5.0.1943
CodeBase: file:----------------------------------------
CrystalDecisions.ReportAppServer.ClientDoc
Assembly Version: 10.5.3700.0
Win32 Version: 10.5.0.1943
CodeBase: file:----------------------------------------
CrystalDecisions.ReportAppServer.DataDefModel
Assembly Version: 10.5.3700.0
Win32 Version: 10.5.0.1943
CodeBase: file:----------------------------------------
CrystalDecisions.ReportAppServer.Controllers
Assembly Version: 10.5.3700.0
Win32 Version: 10.5.0.1943
CodeBase: file:----------------------------------------
CrystalDecisions.ReportAppServer.ReportDefModel
Assembly Version: 10.5.3700.0
Win32 Version: 10.5.0.1943
CodeBase: file:----------------------------------------
CrystalDecisions.KeyCode
Assembly Version: 10.5.3700.0
Win32 Version: 10.5.0.1943
CodeBase: file:----------------------------------------
System.Web
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3082 (QFE.050727-3000)
CodeBase: file:----------------------------------------
crdb_adoplus
Assembly Version: 10.0.3300.0
Win32 Version: 10.5.0.1943
CodeBase: file:----------------------------------------
msvcm90
Assembly Version: 9.0.21022.8
Win32 Version: 9.00.21022.8
CodeBase: file:----------------------------------------
CustomMarshalers
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:----------------------------------------
CrystalDecisions.Enterprise.InfoStore
Assembly Version: 10.5.3700.0
Win32 Version: 10.5.0.268
CodeBase: file:----------------------------------------
System.Web.Services
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:----------------------------------------
CrystalDecisions.ReportSource
Assembly Version: 10.5.3700.0
Win32 Version: 10.5.0.1943
CodeBase: file:----------------------------------------
CrystalDecisions.Enterprise.Framework
Assembly Version: 10.5.3700.0
Win32 Version: 10.5.0.268
CodeBase: file:----------------------------------------
AxInterop.AcroPDFLib
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:----------------------------------------
************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
|
|
|
|
|