Some quetions

  • Thread starter Thread starter Mohammed Abdel-Razzak
  • Start date Start date
M

Mohammed Abdel-Razzak

Dear sirs
I`ve some questions to ask concerning C#

1) I`m making my DB using MS-SQl server and connecting to
it using C#
when I try to save data in the SQL server it saves it
appending spaces to its end
and so when I try to search for some value in my tables I
don`t find it, because it is not written as I did
So how can I fix this problem??

2) I would like to connect to MS-Outlook from my
application to send an email to a specific user(s) I`ve
choosen thier emails from my application
How can I do that??

3) Is there any way that I can declare a variable that all
Forms in my application can see it (Global)

4) I would like to know if there is any control that can
view a web page in my application (I would like to
make 'Help' in my application looks like the one of the
MSDN)
 
Mohammed Abdel-Razzak said:
I`ve some questions to ask concerning C#

1) I`m making my DB using MS-SQl server and connecting to
it using C#
when I try to save data in the SQL server it saves it
appending spaces to its end
and so when I try to search for some value in my tables I
don`t find it, because it is not written as I did
So how can I fix this problem??

I suspect you've set up your columns to be NChar rather than NVarChar.
2) I would like to connect to MS-Outlook from my
application to send an email to a specific user(s) I`ve
choosen thier emails from my application
How can I do that??

Don't know.
3) Is there any way that I can declare a variable that all
Forms in my application can see it (Global)

You can use a public static variable - but it's generally frowned upon
unless it's for a really good reason.
4) I would like to know if there is any control that can
view a web page in my application (I would like to
make 'Help' in my application looks like the one of the
MSDN)

Again, I don't know the best way of doing this.
 
Hi,
1) Change your table column types to variable-length types. (Like varchar,
nvarchar)
2) You can use SQL-Mail, Microsoft CDO 1.21 Library, or "Microsoft Outlook
xx.x Object Library" by adding a com reference. A sample is below.
3) Don't know but, would not be a good design. In my opinion, review your
class design.
4) Microsoft Web Browser Component(shdocvw.dll). But you can use MS HTML
Help to provide user help. And u can make better deisgns with HTML Help
Workshop.

Good Luck
Adnan

Mail Sample:
Microsoft.Office.Interop.Outlook.Application OL = new
Microsoft.Office.Interop.Outlook.ApplicationClass();
Microsoft.Office.Interop.Outlook.NameSpace OLNS =
OL.GetNamespace("MAPI");
Microsoft.Office.Interop.Outlook.Folders OLFld = OLNS.Folders;
Microsoft.Office.Interop.Outlook.Explorer explorer =
OL.Explorers.Add(OLNS.GetDefaultFolder(OlDefaultFolders.olFolderDrafts),
OlFolderDisplayMode.olFolderDisplayNormal);
explorer.Activate();
Microsoft.Office.Interop.Outlook.MailItem mail =
(Microsoft.Office.Interop.Outlook.MailItem)
OL.CreateItem(OlItemType.olMailItem);
mail.To = "to";
mail.Subject = "subject";
mail.Body = "body";
mail.Send();
OL.Quit();
 
in addition to Jons post, make sure you are not writing data with trailing
spaces to sql in the first place because even with variable length types
ANSI PADDING is set to ON by default meaning that trailing blanks not
trimmed (no padding to column length though). Regardless this is the
recommended behaviour that should be used, *but* as suggested use variable
length db types (varchar, nvarchar etc) if you do not want padding to the
original length of the column.

p.s.Nullable fixed length columns with ANSI PADDING OFF setting set will
display the same behaviour as the variable types with this OFF i.e trailing
blanks trimed and no padding (but best to stick to variable types in the
first place unless absolutely necessary)
--


Br,
Mark Broadbent
mcdba , mcse+i
=============
 
Back
Top