|
That would explain it. If you don't close the connection, the number of connections being used on the SQL server increases until it hits the license limit. Then you next connection request will hang until a previous connection is closed, thereby causing the timeout.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hello!!
I use VB.NET to connect AccessXP. It works fine when the database has no password. But when I try to set user name and password and then use VB.NET to connect it again, it fail to test connection and there is error report. The report says about workgroup file. What does it mean and how to solve this problem.
Thanks.
|
|
|
|
|
You need to specify the username and password in your connection string. What is the error ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I use OleDbDataAdapter control to connect the database. When rag this control to my form then "Data Adapter Configuration Wizard" will appear. I set provider to be "Microsoft Jet 4.0 OLE BD Provider". After that, when I select my database and test connection.
- If I use blank password or use wrong password, the error reports "Test connection failed because of an error in initializing provider. Not a valid password.".
- If I use correct password, it reports "Test connection failed because of an error in initializing provider. Cannot start your application. The workgroup information file is missing or opened exclusively by another user."
What should I do with workgroup information file????
|
|
|
|
|
Hello everyone,
Does someone/anyone have a ready code(or open source code) for a Page Hit Counter?(page hit tracker) to count no of hits on a page. I need to embed a page counter on my 'Intranet' applications.
Language : VB.Net
Also, does anyone know of a free downloadable 'search engine' for .NET applications that can be included onto the company intranet system? I did a lot of google for it...but didn't help me much.
Thanks a trillion in advance.Any and all help is much appreciated!
Aartee
...HE is watching Us All!
|
|
|
|
|
arty=me wrote:
Does someone/anyone have a ready code(or open source code) for a Page Hit Counter?(
No, but it's really, really easy. Where-ever you store the count, you just need to increment it every time the page is hit, and it's not a postback. It's up to you if you put it in a text file, or if you have a database already where you can put it.
arty=me wrote:
Also, does anyone know of a free downloadable 'search engine' for .NET applications that can be included onto the company intranet system?
If the intranet is not online, I don't know, but if you have a web site that is online, you can do links to google that search only your site. Given that google are rich, I assume that writing a search engine is not trivial.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I have one digit I/O and one A/D card to build a control system. There have unmanaged drvier. Now I want to use VB .NET to call these VC++ DLLs. I read some articles from here and MSDN how to program. But I try it, can't work. Please help me!, thank James
|
|
|
|
|
James8888 wrote:
I read some articles from here and MSDN how to program. But I try it, can't work.
That's a bit vague. What have you tried, and how is it going wrong ? We can also only give general advice if we don't know anything about the dll you're calling. In C#, you can pInvoke a C++ dll, and I believe VB.NET is the same, although I'm not sure how the syntax differs.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi, Christian
The source code is not at hand now. Later I send to you to check. I try to call functions of unmanaged VC++ DLL. it compiled no error, but can't get the handle ( value is &H0). Can you give me some information or another useful articles / link. Thank you very much!
James
|
|
|
|
|
James8888 wrote:
I try to call functions of unmanaged VC++ DLL.
How did you link to the dll ?
Here[^] is the first hit I got from google.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I call it like this
Imports System.Runtime.InteropServices
Public Class Win32
Declare Auto Function MessageBox Lib "user32.dll" _
(ByVal hWnd As Integer, _
ByVal txt As String, ByVal caption As String, _
ByVal Typ As Integer) As Integer
End Class
But don't know what is difference between above and below
Imports System.Runtime.InteropServices
Public Class Win32
<dllimport ("user32.dll",="" charset="" :="CharSet.Auto)"> _
Public Shared Function MessageBox (ByVal hWnd As Integer, _
ByVal txt As String, ByVal caption As String, _
ByVal Typ As Integer) As Integer
End Function
End Class
What is CharSet?
thanks, James
|
|
|
|
|
James8888 wrote:
Public Shared Function MessageBox (ByVal hWnd As Integer, _
ByVal txt As String, ByVal caption As String, _
ByVal Typ As Integer) As Integer
End Function
End Class
This just defines a function, it doesn't get it from the dll.
Where is CharSet ? It's an Enum to say if you're using ASCII or Unicode, I *think*.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Tomorrow, I'll send you my source code. let you help me to check the problem. thank you for your support.
James
|
|
|
|
|
OK - I'll be happy to look for you.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi, Christian
Below is my VB .NET source code. There is one Click Button Sub. and other three test classes to wrap functions of DLL. 1st is using Declare Function. 2rd is using DLLImport. 3rd is a sample class for User32.dll. it's ok.
I think that the problem maybe parameter type mapping is error bewteen VC++ DLL and VB .NET. Please give me advise. thanks.
Best regars, jiannong
The VB .NET source code is below
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim gnNumOfDevice As Integer
Dim ErrCde As Long
Const SUCESS = &H0
Dim TestDll As TestDLL
Dim TestDll2 As TestDLL2
Dim devicelist As Long
Dim MaxEntries As Integer
Dim nOutEntries As Integer
Dim DeviceNum As Long
Dim DriverHandle As Integer
Dim ErrMsg As String
Dim ptDioWritePortByte As PT_WritePortByte1
Dim Port As Integer
Dim ByteData As Integer
DeviceNum = &H0
ErrCde = &H0
Dim testdll3 As TESTDLL3
testdll3.MessageBox(0, "Hello World", "Platform Invoke Sample", 0)
ErrCde = TestDll2.DRV_DeviceGetNumOfList(gnNumOfDevice)
ErrCde = TestDll.DRV_DeviceGetNumOfList(gnNumOfDevice)
ErrCde = TestDll.DRV_DeviceGetList(devicelist, MaxEntries, nOutEntries)
ptDioWritePortByte.Port = 0
ptDioWritePortByte.ByteData = &H55
ErrCde = TestDll2.DRV_DeviceOpen(DeviceNum, DriverHandle)
TestDll.DRV_GetErrorMessage(ErrCde, ErrMsg)
ErrCde = TestDll2.DRV_WritePortByte(DriverHandle, ptDioWritePortByte)
End Sub
Using Class to Declare DLL function
Imports System.Runtime.InteropServices
<structlayout(layoutkind.sequential)> Public Structure PT_WritePortByte
Dim Port As Integer
Dim ByteData As Integer
End Structure
<structlayout(layoutkind.sequential)> Public Structure PT_WritePortWord
Dim Port As Integer
Dim WordData As Integer
End Structure
'////////////////////////// V2.0C \\\\\\\\\\\\\\\\\\\\\\\\
<structlayout(layoutkind.sequential)> Public Structure PT_WritePortDword
Dim Port As Integer
Dim DwordData As Long
End Structure
'////////////////////////// V2.0C \\\\\\\\\\\\\\\\\\\\\\\\
<structlayout(layoutkind.sequential)> Public Structure PT_ReadPortByte
Dim Port As Integer
Dim ByteData As Long ' USHORT far *ByteData
End Structure
<structlayout(layoutkind.sequential)> Public Structure PT_ReadPortWord
Dim Port As Integer
Dim WordData As Long ' USHORT far *WordData
End Structure
'////////////////////////// V2.0C \\\\\\\\\\\\\\\\\\\\\\\\
<structlayout(layoutkind.sequential)> Public Structure PT_ReadPortDword
Dim Port As Integer
Dim DwordData As Long
End Structure
Public Class TestDLL
'////////////////////////// V2.0C \\\\\\\\\\\\\\\\\\\\\\\\
Declare Function DRV_SelectDevice Lib "adsapi32.dll" (ByVal hCaller As Long, ByVal GetModule As Boolean, ByVal DeviceNum As Long, ByVal Description As String) As Long
Declare Function DRV_DeviceGetNumOfList Lib "adsapi32.dll" (ByVal NumOfDevices As Integer) As Long
Declare Function DRV_DeviceGetList Lib "adsapi32.dll" (ByVal devicelist As Long, ByVal MaxEntries As Integer, ByVal nOutEntries As Integer) As Long
Declare Function DRV_DeviceGetSubList Lib "adsapi32.dll" (ByVal DeviceNum As Long, ByVal SubDevList As Long, ByVal MaxEntries As Integer, ByVal nOutEntries As Integer) As Long
Declare Function DRV_DeviceOpen Lib "adsapi32.dll" (ByVal DeviceNum As Long, ByVal DriverHandle As Long) As Long
Declare Function DRV_DeviceClose Lib "adsapi32.dll" (ByVal DriverHandle As Long) As Long
' Declare Function DRV_DeviceGetFeatures Lib "adsapi32.dll" (ByVal DriverHandle As Long, ByVal lpDevFeatures As PT_DeviceGetFeatures) As Long
Declare Sub DRV_GetErrorMessage Lib "adsapi32.dll" (ByVal lError As Long, ByVal lpszszErrMsg As String)
Declare Function DRV_WritePortByte Lib "adsapi32.dll" (ByVal DriverHandle As Long, ByVal WritePortByte As PT_WritePortByte) As Long
Declare Function DRV_WritePortWord Lib "adsapi32.dll" (ByVal DriverHandle As Long, ByVal WritePortWord As PT_WritePortWord) As Long
Declare Function DRV_ReadPortByte Lib "adsapi32.dll" (ByVal DriverHandle As Long, ByVal ReadPortByte As PT_ReadPortByte) As Long
Declare Function DRV_ReadPortWord Lib "adsapi32.dll" (ByVal DriverHandle As Long, ByVal ReadPortWord As PT_ReadPortWord) As Long
End Class
Using Class to declare function by DLLImport
Imports System.Runtime.InteropServices
<structlayout(layoutkind.sequential)> Public Structure PT_WritePortByte1
Dim Port As Integer
Dim ByteData As Integer
End Structure
Public Class TestDLL2
<dllimport("adsapi32.dll")> _
Public Shared Function DRV_DeviceGetNumOfList(ByVal NumOfDevices As Integer) As Long
End Function
Public Shared Function DRV_DeviceOpen(ByVal DeviceNum As Long, ByVal DriverHandle As Integer) As Long
End Function
Public Shared Function DRV_WritePortByte(ByVal DriverHandle As Integer, ByVal WritePortByte As PT_WritePortByte1) As Long
End Function
End Class
Try the sample, it’s Ok
Imports System.Runtime.InteropServices
Public Class TESTDLL3
Declare Auto Function MessageBox Lib "user32.dll" _
(ByVal hWnd As Integer, _
ByVal txt As String, ByVal caption As String, _
ByVal Typ As Integer) As Integer
End Class
|
|
|
|
|
I don't see anything wrong with the code. Where does the dll come from ? Can you send me a copy and I'll have a look ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
The DLL is Aventech Digit I/O PCI driver. Yah, The compiler said ok. But I cann't access the function in DLL. THanks.
Best regards, jiannong
|
|
|
|
|
Hello to Anyone
I am new to programming. I have set up a form with one datagrid. Using odbc connections to a progress 9.1c database I have been able to set up the datagrid to fill the data from one of the tables in the database. However I have not been able to get it to update data back to the table. I was hoping someone could send me in the right direction for finding good information on using odbc connection. The data connector did not build the sql strings for update or delete and I have added them to the properties page for the datadapter. But I am guessing that the code is not calling this when I do an update.
Would it be better to write all the code to make connections and datasets??
Any and all help would be greatly appreciated.
Mike
|
|
|
|
|
If you want to do things right use stored procedures. Also, any vb.net book has sqlcommand examples.
"People who never make mistakes, never do anything."
My blog
http://toddsnotsoamazinglife.blogspot.com/
|
|
|
|
|
I'm using a VB6 application with an FP Spread control. I need a way to check to see if the date was entered complete and in the right format. This is the idea that I have but does not work:
With fpsScr
If .ActiveCol = 6 And .ChangeMade Then
If .Text <> "##/##/####" Then
MsgBox "The date was not entered correctly. Please try again.",_
vbOKOnly, "Incorrect Date Entry"
End If
End If
End With
Can someone help me?
ryanchk
|
|
|
|
|
If .Text <> "##/##/####" Then
Replace this with:
if IsDate(.Text) then
|
|
|
|
|
thealca,
I appreciate you taking the time te help me. The solution checks to see if the field is a date but I also need to make sure that the date wasn't entered incorrectly, i.e. if someone just enters 5/05 I want to display the message to have them re-enter the date.
ryanchk
|
|
|
|
|
im creating a game cheating/game hacking utility and i was wondering if anyone has any examples of dll injection with vb.net
|
|
|
|
|
No, I doubt you can do that in VB.NET. VB exists to make it easy to write a certain type of application. To do powerful stuff you need C++.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I can't find a simple way to move a folder from one place to another without identical roots (directory.move, file.move), or even better, copy a folder, then paste it into another directory(without identical root).
|
|
|
|