|
Thanks Eddy,
I know VB6 is no longer supported from Microsoft, but he is our Old Client and i have to do a lot of things as per your recommendation. I have to get data faster (huge and from multiple table) only on 2 forms and that's it. so please if you can help.
|
|
|
|
|
Yusuf Mohammad wrote: so please if you can help. I did; see the previous post, there's a link to a CodeProject-article that explains how to run a stored-procedure using VB6.
Yusuf Mohammad wrote: I know VB6 is no longer supported from Microsoft, but he is our Old Client
I wish your old client lots of success; if he's not migrating yet, he's setting himself up for a huge problem. Like I said, VB6 isn't for sale anymore, and newer Windows-version will not be tested with VB6 applications. There's no guarantee that any VB6-app will still work tomorrow, any update could kill it.
|
|
|
|
|
It's difficult to find documentation for this - all of the VB6 documentation on MSDN has been retired.
Looking at the .NET compatibility wrapper[^], you should have a property called CommandType , which you need to set to adCmdStoredProc (or 4 if the constant isn't defined).
I don't think there's any way to pass parameters to the query, other than using an ADODB.Command to manually execute the query and assigning the results to the Recordset property on the ADODC control.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
|
Why did you have to do that man.
Here we are, on a mission to rid the world of the unholy abomination that is VB6 and you just had to go dig up documentation for it.
|
|
|
|
|
I have seen the Update Statement using Stored Procedure. I haven't try that code but i think it should work. Unfortunately not able to find Select Statement using Stored Procedure.
|
|
|
|
|
I want to know, how the program draw the shape in picture box??? (eg, circle, recentangle, triangle.)
|
|
|
|
|
have a read of this
DrawRectangle in a Picture box.....[^]
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
Hello,
Everywhere i read that the .png file format is a lossless file format.
What i am trying to do is downsize a .png file without the loss of color quality. Is this possible?
my code so far(but always losing color quality):
Dim im As Image = Image.FromFile("c:\temp\aaa\Copy.png")
Dim bm As Bitmap = New Bitmap(600, 600, im.PixelFormat)
bm.SetResolution(im.HorizontalResolution, im.VerticalResolution)
Dim g As Graphics = Graphics.FromImage(bm)
g.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias
g.InterpolationMode = Drawing2D.InterpolationMode.HighQualityBicubic
g.DrawImage(im, 0, 0, 600, 600)
bm.Save("c:\temp\aaa\test.png", Imaging.ImageFormat.Png)
Thanks for any help;
|
|
|
|
|
Hold on a second....
"Lossless" means that saving an image compressed to reduce it's file size will not degrade the image whatsoever.
However, you are resizing the image - therefore - if you are resizing it smaller - you will "lose" pixels from the original.
As well - if you are increasing the size of an image - depending on the resizing algorithm used - you'll get approximations of the newly added pixels.
|
|
|
|
|
I found this a few days ago: Painting Your Own Tabs - Second Edition[^]. I put it into my project, and when I docked it, it bugged out like there's no tomorrow. I can't even edit the properties or anything ._.
|
|
|
|
|
|
Just wondering if anyone had any fixes or anything. I was able to edit the properties, and I tried to build it, and it's been trying to build for at least half an hour.
|
|
|
|
|
If you have problems with something you find in a CodeProject article then use the forum at the end of the article to communicate with the author.
|
|
|
|
|
I'm writing an update to a software package that takes binary data from an instrument and creates a spreadsheet. There is a column that list a reading mode that in the older version of the software outputted either "TC" or "QM". Now in the updated version I want it to write something more descriptive; that being either "Time Corrected" or "Quick Mode", but I still want to maintain backwards compatibility.
I thought the best way to do this would be to use custom attributes where the new description and old description would be saved and then based on the settings of the software the program could choose the proper description.
First I created a custom attribute class:
<AttributeUsage(AttributeTargets.Field, AllowMultiple:=True, Inherited:=False)>
Public Class OutputDescriptionAttribute
Inherits Attribute
Private _oldDescription As String
Private _newDescription As String
Public Sub New(oldDescription As String, newDescription As String)
Me._oldDescription = oldDescription
Me._newDescription = newDescription
End Sub
End Class
Then I created the enum and applied the attributes:
Public Enum ReadingModeType
<OutputDescription("TC", "TimeCorrected")> TimeCorrected
<OutputDescription("QM", "QuickMode")> QuickMode
End Enum
Lastly I copied a method off of Microsoft's website that is supposed to get the values from custom attributes:
Public Shared Sub GetDescription(t As Type)
Dim MyAttribute As OutputDescriptionAttribute =
CType(Attribute.GetCustomAttribute(t, GetType(OutputDescriptionAttribute)), OutputDescriptionAttribute)
If MyAttribute Is Nothing Then
Console.WriteLine("The attribute was not found.")
Else
End If
End Sub
I got this method from http://msdn.microsoft.com/en-us/library/71s1zwct.aspx[^]. I then called this method like so:
Private Sub MainWindow_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded
Dim s As ReadingModeType = ReadingModeType.QuickMode
test.GetDescription(s.GetType)
End Sub
However when I step through the code in the GetDescription method, the MyAttribute object returns nothing. This is my first time working with custom attributes so I know I'm probably missing something very simple. Can anyone please advise me how I can retrieve the descriptions for the attribute applied to the specified enum value?
Thanks in advance.
|
|
|
|
|
You'd need to fill a FieldInfo from the field whose attributes you'd wish to query. I've included a sample to reference;
Module Module1
<AttributeUsage(AttributeTargets.Field, AllowMultiple:=True, Inherited:=False)>
Public Class OutputDescriptionAttribute
Inherits Attribute
Private _oldDescription As String
Private _newDescription As String
Public Sub New(ByVal oldDescription As String, ByVal newDescription As String)
Me._oldDescription = oldDescription
Me._newDescription = newDescription
End Sub
Public ReadOnly Property CurrentDescription As String
Get
Return _newDescription
End Get
End Property
End Class
Public Enum ReadingModeType
<OutputDescription("TC", "TimeCorrected")> TimeCorrected
<OutputDescription("QM", "QuickMode")> QuickMode
End Enum
Sub Main()
Dim TCFieldInfo As Reflection.FieldInfo = GetType(ReadingModeType).GetField("TimeCorrected")
Dim customAttributes As Object() = TCFieldInfo.GetCustomAttributes(inherit:=True)
For Each Attrib As Attribute In customAttributes
If Attrib.GetType() Is GetType(OutputDescriptionAttribute) Then
Dim outputDescriptionAttrib As OutputDescriptionAttribute =
CType(Attrib, OutputDescriptionAttribute)
Console.WriteLine(outputDescriptionAttrib.CurrentDescription)
End If
Next
Console.ReadLine()
End Sub
End Module
|
|
|
|
|
Dear all,
I am currently new into programming in classic asp and require little help in executing the following code:
<%
searchInput = Request.QueryString("searchInput")
Set myRecordSet = Connect.Execute("SELECT * FROM dbo.tt WHERE cusip LIKE '%" & searchInput & "%' OR isin LIKE '%" & searchInput & "%'")
if myRecordSet.EOF then
response.write("You searched for: " & searchInput & "<br>")
response.write("A match was not found.<br>Sorry try again.")
else
response.write("You searched for: " & searchInput & "<br>")
response.write("Records were found!<br>The matches are:<br>")
do until myRecordSet.EOF
response.write(myRecordSet("name") & "<br>")
response.write(myRecordSet("cusip") & "<br>")
response.write(myRecordSet("isin") & "<br>")
myRecordSet.MoveNext
loop
end if
%>
The search function does not perform accurately, as when I type in "123" in the search criteria, it display all the records, instead of specific records. It also display records, when I select submit button with blank search criteria.
Any help to overcome the following problem above. Thank you for your time and help.
|
|
|
|
|
miss786 wrote: I am currently new into programming in classic asp
It's not the ASP code, but the SQL query.
miss786 wrote: It also display records, when I select submit button with blank search criteria.
That's the way the query is set up:
WHERE cusip LIKE '%%' OR isin LIKE '%%' -> that means everything.
Can you give an example-population where it displays a record that you'd like to omit?
|
|
|
|
|
Thank you so much for your response and help. Apology for the late response.
CREATE TABLE tt(
name char(2) NOT NULL,
cusip varchar(30) NULL,
isin varchar(30) NULL)
INSERT INTO tt VALUES
('a1', 'XS123', NULL),
('b1', 'XS234', NULL),
('c1', NULL, 'US345'),
('d1', NULL, '5666'),
('e1', 'US3456', NULL),
('a1', NULL, '123'),
('b1', NULL, NULL),
('a1', NULL, NULL)
Using the above DDL, if enter "xs" in the search criteria, I get the all instances as result output, instead I should only get records "a1" and "b1".
Any help on this issue, I would really appreciate your help.
Thank you
|
|
|
|
|
Thanks for including a nice test-script, makes life a bit easier.
BEGIN TRANSACTION
CREATE TABLE tt(
name char(2) NOT NULL,
cusip varchar(30) NULL,
isin varchar(30) NULL)
INSERT INTO tt VALUES
('a1', 'XS123', NULL),
('b1', 'XS234', NULL),
('c1', NULL, 'US345'),
('d1', NULL, '5666'),
('e1', 'US3456', NULL),
('a1', NULL, '123'),
('b1', NULL, NULL),
('a1', NULL, NULL)
SELECT *
FROM tt
WHERE cusip LIKE '%xs%'
OR isin LIKE '%xs%'
ROLLBACK Well, seems to work. Can you verify that the dataset is empty, "before" you execute the query? And log/print/inspect the resulting query that's being built?
|
|
|
|
|
Thank you so much for your help.
I am not sure what you mean by "Can you verify that the dataset is empty, "before" you execute the query"?
This query would always give the output of records a1 and b1 but how can i build a search criteria for the client side, if the user enters "us" in the search criteria, it would show record "e1" or the id the user enters "00", it would show an error saying to "try again, no record found", or if the user searches "3" in the criteria, it would show records "a1, b1 and c1" and so on.
I really appreciate your time and help.
Thank you for your time and guidance.
|
|
|
|
|
miss786 wrote: I am not sure what you mean by "Can you verify that the dataset is empty, "before" you execute the query"?
The result of the query is loaded into a dataset; that's an object that gets created somewhere, and it might already contain data - since the query looks correct, I'm wondering where these other records came from, and it might be that they were there before the query executed.
I doubt that this is the problem, as the object "should" be replaced with a new one on the line where the query executes;
Set myRecordSet = ...
miss786 wrote: This query would always give the output of records a1 and b1 but how can i build a search criteria for the client side, if the user enters "us" in the search criteria, it would show record "e1" or the id the user enters "00", it would show an error saying to "try again, no record found", or if the user searches "3" in the criteria, it would show records "a1, b1 and c1" and so on.
We verified the query yesterday, and it is correct. The ASP-code looks correct too, meaning that it places the user-input in the right spot.
The code below should print the query that's being built in the output-window of the VS-IDE. You might want to check whether the generated query looks as expected (I see no reason why not) and whether it runs when you execute it directly on the server.
Dim myQuery As String = "SELECT * FROM dbo.tt WHERE cusip LIKE '%" & searchInput & "%' OR isin LIKE '%" & searchInput & "%'"
Debug.Print(myQuery)
Set myRecordSet = Connect.Execute(myQuery)
If all else fails, I'll debug it in the weekend. Already got the query and the relevant piece of ASP, so I could try and build it.
|
|
|
|
|
I only needed to include a connection in the code;
<%
searchInput = "xs"
Set oConnection = Server.CreateObject("ADODB.Connection")
oConnection.Open "Driver={SQL Server};Server=.\MSSQL;Database=master;Trusted_Connection=yes;"
Dim sQuery
sQuery = "SELECT * FROM dbo.tt WHERE cusip LIKE '%" & searchInput & "%' OR isin LIKE '%" & searchInput & "%'"
Response.Write("sQuery=" & sQuery)
Set myRecordSet = oConnection.Execute(sQuery)
if myRecordSet.EOF then
response.write("You searched for: " & searchInput & "<br>")
response.write("A match was not found.<br>Sorry try again.")
else
response.write("You searched for: " & searchInput & "<br>")
response.write("Records were found!<br>The matches are:<br>")
do until myRecordSet.EOF
response.write(myRecordSet("name") & "<br>")
response.write(myRecordSet("cusip") & "<br>")
response.write(myRecordSet("isin") & "<br>")
myRecordSet.MoveNext
loop
end if
oConnection.Close
Set oConnection = Nothing
%>
I got these results in the browser;
<br />
sQuery=SELECT * FROM dbo.tt WHERE cusip LIKE '%xs%' OR isin LIKE '%xs%'You searched for: xs<br />
Records were found!<br />
The matches are:<br />
a1<br />
XS123<br />
<br />
b1<br />
XS234
Did you "Dim" the myRecordset in code that was not in your post? Reusing a previous variable?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
So, I'm making a webbrowser with tabs, and so I'm using the
Dim browser As New Webbrowser function. I had the dock property on fill, so that it would fill the tabcontrol. However, I had a statusstrip docked at the bottom of the tabcontrol. When the webbrowser was docked to fill the tabcontrol, it covered up the statusstrip. How do I make it not do this?
NSoft Developer
|
|
|
|
|
Use the Anchor property rather than Dock .
|
|
|
|
|