|
Dear all,
I was trying to automatically to import data from excel into Access Database.
The code was like this.
Dim myUploadConnection As New ADODB.Connection<br />
Dim SQLString As String<br />
Try<br />
myUploadConnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Application.StartupPath & "\HDTL.xls; Extended Properties=Excel 8.0;"<br />
myUploadConnection.Open()<br />
<br />
SQLString = "SELECT * INTO " & _<br />
"[PROVIDER=Microsoft.Jet.OLEDB.4.0; DRIVER={Microsoft Access Driver (*.mdb)}; " & _<br />
"DBQ=" & Application.StartupPath & "\PlasmaDB.mdb;].HDTL " & _<br />
"FROM [HDTL$]"<br />
<br />
myUploadConnection.Execute(SQLString)<br />
myUploadConnection.Close()<br />
<br />
Catch ex As Exception<br />
MsgBox(ex.Message, MsgBoxStyle.Critical, "Error")<br />
End Try
When run the proses I received error message "Can't Update. Database or object is read only".
Please tell what have I missed
Many thanks and regards,
WiL
|
|
|
|
|
hi all,
i have my web application running on a server and i found out that the aspnet_wp.exe process causing a high CPU usage on the server (running win server 2k with IIS 5.0 and .net framework 1.1). It caused my application running slow and stopped responding. Is that the framework problem? Any ideas how to solve that? thanks in advance
elcheah
|
|
|
|
|
That depends entirely on what code is running to cause the high CPU usage. Normally, this is something you wrote and not a problem with IIS or the .NET Framework.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
System.NullReferenceException: Object reference not set to an instance of an object. at ForumVB.dotForumTopicEdit.editTopic.submitter_update(Object sender, CommandEventArgs e) in c:\inetpub\wwwroot\ForumVB\admin\topicEdit.aspx.vb:line 109
plz help me...........
|
|
|
|
|
Go to topicEdit.aspx.vb, line 109. Some object there which you're trying to use has a value of null.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
but i already set particular object to allow Null in my database..... why stil got such error???
|
|
|
|
|
Because your trying to call an instance member on something that doesn't have an instance. Without seeing your code around the line that the error is occuring on, we can't help you.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
oic, i understand ur meaning... anyway thanks a lot for ur explaintion
Thanks
|
|
|
|
|
I have finished my application, and I since the application will open in the users computer every whole day. I am going to see the memory usage.
It is shock!!
it use up me 45MB memory!!
and I find that, when I change the image of picture box, it use 1MB each time.
How can I free those memory ?
My code in this field is really simple,
<br />
picPreview.Image = Bitmap.FromFile(tempPreviewFile)<br />
Thank you!
|
|
|
|
|
I guess the picture box doesn't manage the memory as it should. Try calling Dispose on the Image before setting another. A better solution is not to use the picture box at all.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
First, don't use TaskManager to look at your memory consumption. You're seeing the memory that your the CLR RESERVES for the entire virtual machine your app is running in, not necessarily used by your application.
Use the Performance Monitor and the .NET counters to see your actual memory consumption. You can also use a memory profiler, like CLRProfiler, to see exactly how your app is allocating memory.
Also, if you do discover that your app isn't releasing memory, make sure you Dispose any graphics objects you're using, specially any and all GDI objects. This also includes images, like Image and Bitmap objects!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
|
Hi, can anyone give me an idea or concept about send and recieve mail in outlook express using vb6?
|
|
|
|
|
Outlook Express doesn't expose any kind of an object model for you to use. It is, for all intensive purposes, a wrapper for Win32's MAPI interface.
Soooo, Google for vb6 mapi[^] and you'll find what you're looking for.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thank you dave, I also look through an article from http://abstractvb.com/code.asp?A=713[^]. But when i do it in vb6, it say that object require. This error because the default name is MAPIMessages1 but in the code is MAPISession1 . But when i change the name to MAPIMessage1 , there is no Sign on method that I could you in my code. Do you have any solution? An error still keep the same.
|
|
|
|
|
The code is pretty straight forward. So long as you have a reference to the MSMAPI32.OCX, the code will work as documented.
All you did was change the variable name. This doesn't change the control your using, just what you call that instance.
The code works as documented, so about the only thing I can think of is you didn't set a reference to the OCX file.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
How can i create a long string with a hyperlink(different colored text) in the middle of the string and draw it to the form? I am trying to make it so that when I write the string I can set the link with a key word.. eg... String = "This is my string, so <mylink>click here<mylink>".
can anybody help?
Mark Thibodeaux
|
|
|
|
|
Try using a LinkLabel control. You can setup this control to show both normal text and a link. It can even display multiple links within its text. But you can't add the link from the designer. It must be done in code.
myLink.Text = "This is my string, so click here"<br />
Const linkString As String = "here"<br />
myLink.Links.Add(myLink.Text.IndexOf(linkString), linkString.Length)
-- modified at 20:54 Monday 16th January, 2006
Let me rephrase this a little. The text you enter into a LinkLabel in the form designer will become one big link, which is not what you want. If you want to embed a link within normal text, then you must do this via code as shown above.
|
|
|
|
|
Thanks that works. One little question, I have seen a few balloon tooltips that are floating out there, how do they make it where all you have to do is write your string and wrap the word or words that you want to be a link with their tag (similar to html). Just wondering.
Thank you,
Mark
Mark Thibodeaux
|
|
|
|
|
The standard tooltip control can't display links in it.
You may have to use a 3rd party control or make your own.
|
|
|
|
|
I am responsible for a c++ dll that can be invoked by visual basic. Here is an example c++ prototype for one of the functions:
int __stdcall GetClock(
int device_type,
int address,
char **return_str,
int *return_str_len);
The basic premise here is that the DLL manages a buffer to which it writes text information (like the clock value). When the function is complete, the DLL will have assigned return_str to point to this internal buffer and will also have written the length of the text in the return_str_len parameter.
I am puzzled as to how to do this in visual basic 6. Other people that have been using this DLL have declared the parameter as byref string. The disturbing thing about this is that it appears to work. Any guidance would be appreciated.
Regards,
Jon Trauntvein
|
|
|
|
|
Strings are passed to DLLs a little differently than the other data types in VB6.
Passing a string ByVal (by value) really just passes a pointer to that string. This is how you would normally pass a string in C too, because passing an entire array of characters would be inefficient.
Now, since passing a string ByVal passes a pointer, then logically passing a String ByRef would pass it as a double pointer. So, there you go.
|
|
|
|
|
I still see a problem here. My understanding is that VB uses the BSTR type internally. This type is unicode rather than single byte and, as I understand it, this type also expects the length of the string to precede the pointer. I further believe that VB assumes responsibility for releasing the storage (given that it would be the same as a in/out parameter in COM). None of these semantic rules apply in the case of this DLL and I am obligated to keep the function calls as they are currently defined.
My solution is to change the VB prototypes so that the pointer is passed as a byref long and I have added a new function that VB applications can call that will return the results of the last call as a BSTR object.
|
|
|
|
|
Yes, a VB string is a BSTR. It keeps a count of chars instead of forcing you to NULL terminate your strings. But doing a "ByVal myString" only sends the pointer to the character buffer and not the BSTR itself. Otherwise you would have a difficult time making calls to the Win32 libraries from VB6, which is a common thing. Just do a search on "VB6 API" and you'll see what I'm talking about. Now, the string that actually gets sent to your DLL will be NULL terminated. Turns out the BSTR does NULL terminate its string buffer internally (at least that's what it looks like).
Take a look at the StrPtr() function. It helps you send a VB6 string pointer to a win32 functions if you want to do this manually. You can use VarPtr() to get a pointer to a variable, such as the BSTR itself.
You might also want to take a look at StrConv() which you'll need to convert your string to/from ASCII, unicode, and MBCS (Multi-byte character system; this one is nasty).
Here's some helpful link. I just learned a couple new things myself here.
http://support.microsoft.com/default.aspx?scid=kb;en-us;199824[^]
http://vb.mvps.org/tips/varptr.asp[^]
http://www.romanpress.com/Articles/Strings_R/Strings.htm[^]
|
|
|
|
|
Hello,
I'm fairly new to scripting in VB and especially using the WMI classes. One of the things I would like to do is get the Hard drive Serial Number. I am trying to use the Win32_PhysicalMedia but in vain. This is my code:
strComputer = "."
Set objWMIService = GetObject( _
"winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery( _
"Select * from Win32_PhysicalMedia")
If Err.Number = 0 Then
For Each objItem in colItems
Wscript.Echo "Serial: " & objItem.SerialNumber
Next
Else
MsgBox "The serial number could not be returned."
Err.Clear
End If
I know I'm missing something. Can someone please help me with this? Any help would be appreciated. Thank you!
|
|
|
|