|
Private Function createThumnail(ByVal ImageStream As Stream,
ByVal tWidth As Double, ByVal tHeight As Double) As Byte()
Function NewthumbSize(ByVal currentwidth As Double, ByVal
currentheight As Double, ByVal newWidth As Double, ByVal newHeight As Double)
tech_garden@yahoo.com
|
|
|
|
|
Wrong forum. You'll get a better response in the C# or VB.NET forum
|
|
|
|
|
Stream is an object and it should be passed by ref which is the default action for ref types so ...
Actually, I was going to answer but I can't be bothered to correct the spelling and capitalization.
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
I have a class which looks like that:
class Stuff
{
Dictionary<string, object> properties;
List<Stuff> children;
}
I'm writing a home made XML 'serialization'.
I quote that, because it's not serialization, I'm writing the XML writer myself (without System.Reflection).
I'm using a shema like that:
<stuff count=2 key1="value1" key2="value2" key3="value3">
<stuf>
.........
</stuff>
<stuf>
.........
</stuff>
</stuff>
where count = children.Count
and key1,2,3 are the keys in the properties dictionary and value1,2,3 their values.
properties is to be filled by the user with whatever (s)he wants.
Now my problem is:
==============
As the user could put whatever (s)he wants in the properties dictionary (s)he could as well create a key named 'count', therefore the 'count' atribute will be present twice in the tag.
It's not a problem for my reader (which expect a first count followed by any kind of attribute) but it might be for other people wanting to consume my XML documents.
What do you think?
it's actually much easier this way...
(particularly because this sample output is far from the whole story)
|
|
|
|
|
Have you looked into xsd.exe for class generation? Personally I like strong types. Count should be implicit, btw.
<stuff>
<item key="value1" value="someValue">
<item key="value2" value="someValue">
<item key="value3" value="someValue">
<item key="value4" value="someValue">
A man said to the universe:
"Sir I exist!"
"However," replied the Universe, "The fact has not created in me A sense of obligation."
-- Stephen Crane
|
|
|
|
|
uh?
I don't think auto-generated code will work in this case...
count is explicit only for performance reason....
|
|
|
|
|
Hi, I need to create a 6 character random alphnumberic serial number. How can this be achieved in SQL Server 2000? I have been searching and found that Oracle has a function for this, so I am assuming there should be one for SQL then. I could do this easily in .net - but I dont want to have to keep sending a request to the database to check that this number is unique. I would prefer to do the whole thing in a SQL function. So far the only way I have been able to work out, is too create a new GUID - select 6 characters from it - then check that these are not already used in the table (otherwise create a new one and repeat) and insert it.
Any help on this?
Thanks
Wayde
|
|
|
|
|
Ok, I found a way of doing this, may not be the best, but it what I thought of:
DECLARE @Length INT, @Count INT, @RandNum INT, @RandomString VARCHAR(6), @IsValid BIT
SELECT @RandomString = '', @Count = 0, @IsValid = 0, @Length = 6
WHILE (@IsValid = 0)
BEGIN
WHILE @Count < @Length
BEGIN
SET @RandNum = SUBSTRING(CAST(Rand() AS VARCHAR(20)), 3, 2)
IF (((@RandNum > = ASCII('0')) And (@RandNum <= ASCII('9')) Or (@RandNum > = ASCII('A')) And (@RandNum < = ASCII('Z'))))
BEGIN
SET @RandomString = @RandomString + CHAR(@RandNum)
SET @Count = @Count + 1
END
END
--Check here that the number is unique
IF (SELECT certificateSerialNumber FROM Certificate WHERE certificateSerialNumber = @RandomString) IS Null
BEGIN
SET @IsValid = 1
END
END
SELECT @RandomString
This cannot be used as a function though, due to the RandNumber generator. You can also emit the last part that checks if the value is unique. Change the @Length and @RandomString size to suit the size of the field that you need.
|
|
|
|
|
I had created a table User with a field UserOpinion which is of 'text' data type here maximum of onnly 10 lines i am able to enter data rest all data are getting truncated. Is there any way to avoid this truncation of data so that i can enter more than 100 lines of data.
ItsMe
|
|
|
|
|
Are you looking at the result in Query Analyzer? Query Analyzer has a limit on the number of characters it will display from any given column, which defaults to 256. You can change this in Tools, Options, Results tab, 'Maximum characters per column'.
Otherwise I've never heard of data being truncated like this. Check how you're adding it to the database. Perhaps you need to increase the Size property of the Parameter object you're using - I normally set this to the length of the data I'm going to set.
|
|
|
|
|
No i have designed a table with text as the data type. By rule this text data type enable a field to accept more than 2 lakh characters. But if inserted data containing 10 thousand characters and tried to fetch the data from backend , i also checked for the data length , it showed only maximum of 4000 not more than that.
ItsMe
|
|
|
|
|
That sounds like you're using a parameter of nvarchar type, which in classic ADO is adVarWChar or in ADO.NET SqlDbType.NVarChar . This type has a limit of 4000 characters in SQL Server 2000. You need to use adLongVarChar to match a text column in ADO, or SqlDbType.Text .
If you want Unicode support in your database field, use ntext rather than text . If developing exclusively for SQL Server 2005, consider using {n}varchar(max) rather than {n}text .
|
|
|
|
|
Hi,
I need to set mutiple values parameter in Sybase ASE stored procedure. I don't know whether Sybase support array type parameter and how to set it.
|
|
|
|
|
Hi,
using VS2005, C#
I have two datatables with a parent/child relationship using the MemberID int as the key to the relationship. The parent datatable is MembershipDetails and the child datatable is Subscriptions.
The user only knows the MembershipNumber but the program needs to ascertain the corresponding MemberID to insert it into the child table (Subscriptions) along with other data. The MembershipNumber is located in the MembershipDetails table.
In other words:
MembershipDetails.MembershipNumber begets MembershipDetails.MemberID
Is it necessary to loop thru all the MembershipDetails rows to find the MemberID?
Glen Harvy
|
|
|
|
|
insert into Subscriptions<br />
select MemberID, 5 as QtyOrdered, getdate() as DateSubscribed from MembershipDetails where MembershipNumber = 1
In the absence of other field names and data, I made some up.
--EricDV Sig---------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
Hi and thanks for your response.
What I was really after was the code to use in gathering the data from the dataset and not the database.
-- modified at 20:04 Monday 14th August, 2006
Glen Harvy
|
|
|
|
|
Hi,
I was wondering if I could reduce my SQL statements when using comboboxes for search parameters.
For example:
Combobox with this list:
<Categories
Shirts
Pants
Shoes
Because I don't want a Category search if "<Categories" is selected I have an if statement like this:
if (comboBox_Categories.SelectedIndex != 0)
{
SELECT yada yada WHERE ItemID=8 AND Categories=comboBox_Categories.SelectedValue
}
else
{
SELECT yada yada WHERE ItemID=8
}
I have several ComboBoxes that supply possible parameter variables (that may or may not be used). This creates many possible SQL statements. Any sugestions on how to go about this differently?
Thanks!
Ron
-- modified at 18:37 Sunday 13th August, 2006
|
|
|
|
|
SELECT ColumnNames
FROM TableName
WHERE ItemId = @ItemId AND
(@CategoryID IS NULL OR CategoryID = @CategoryID)
The last line is the key - If you send an empty selection on the ComboBox as a DBNull.Value to the SqlCommand then you'll get the behaviour you want out of one SQL Command.
The last line basically means. If the @CategoryId is NULL then I'm not interested in anything else, I'm TRUE therefor the whole OR expression will be TRUE . If the @CategoryID is something other than NULL then I have to evaluate that against the column CategoryID
Does this help?
|
|
|
|
|
Thanks Colin!
I thought there might be a better way to go about it.
I guess it's kinda like an "else if" statement... it'll only
go the the "else if" if the "if" statement was not satisfied.
Thanks again Colin,
Ron
|
|
|
|
|
hi.
i want to know how i can handle closing page event.
i mean that if i want to do something before closing page.
thank for help.
ABONASSER
|
|
|
|
|
This forum deals with database issues. Perhaps you might want to try a forum that deals with web application issues.
|
|
|
|
|
Hey.
I know that the Structured Query Language for MDB (Access) is differrent then the SQL of MySQL.
I'm currently moving my databases from Access to MySQL, but I don't know the syntax of the SQL.
If anyone can help me, or give me a dictionary or some internet help and some samples, I would appriciate it.
Thanks alot.
NaNg.
|
|
|
|
|
See my answer to you in the C# forum.
|
|
|
|
|
What is the erorr with this select statement
Set RS = DB.OpenRecordset("select * from Users where User_name=" & Text1.Text & " and User_pass=" & Text2.Text & " and User_type=" & Combo1.List(Combo1.ListIndex))
I use it in vb6 with DAO 3.5
but the compiler tell that too few parameter.Expected 2
all these fields in the table is text
please help
thanx
BE OR NOT TO BE
|
|
|
|
|
You are missin single quotes around the sring values (Text1.Text, Text2.Text) so they are treated as symbolic names for parameters: (extra spaces around ' not needed)
"select * from Users where User_name= ' " & Text1.Text & " ' and User_pass= ' " & Text2.Text & " ' and
|
|
|
|