| MSDE and TransactionScope |
|
 |
Index ‹ DotNet ‹ ADO
|
- Previous
- 1
- Visual C#.Net >> COM interoperatability using PInvoke (SEH Exception)Hi All,
I am trying to call COM Component in .NET using PInvoke.
In the following scenario, ( I am getting an exception called SEH -
External component has thrown an exception)
UnManaged Code
---------------
virtual HRESULT IDispatch::GetIDSOfNames(const IID & riid, LPWSTR *
rgizNames, UINT CNames, LCID lcid, DISPID *rgDispID)
Managed Code (I have rewritten)
------------
int GetIDsOfNames ([In] System.Guid guid, ref System.String[]
rgNames,[In] System.UInt32 cNames, [In] System.UInt32 lcid,
[Out] out long[] dispID);
Public Test()
{
AXIDispatch pIScriptDispatch;
String[] wszScriptFunctions = new String[1];
wszScriptFunctions[0] = "entryMethod";
long[] dispIDFunctions = new long[1];
pIScriptHost.GetScriptDispatch (out pIScriptDispatch);
IntPtr p = Marshal.GetIDispatchForObject(pIScriptHost);
IntPtr ppv;
Marshal.QueryInterface(p,ref diug,out ppv);
pIScriptDispatch = (AXUtil.AXIDispatch)Marshal.GetObjectForIUnknown(ppv);
try
{
pIScriptDispatch.GetIDsOfNames (guid,ref wszScriptFunctions, 1,
1033, out dispIDFunctions);
}
catch (Exception ex)
{
Console.WriteLine (ex.ToString ());
}
}
If I execute Test() I will be getting the following Exception for
Invoking "GetIDsOfNames(....)"
System.Runtime.InteropServices.SEHException: External component has
thrown an exception.
What could be the reason to get this kind exeception, I don't know
what to do in order to handle it error. Could anyone
kindly help me to solve ? I will greatly appreciate.
Thanks & Regards
R. Muthiah Samy
- 2
- Microsoft Project >> Overallocation issueHi All,
I have also another overallocation problem and I got crazy with it last
2 months. It became quite critical for me and still can't solve it.
I've simplified it (8 basic tasks over 8 phase), 4 resources, single
resource assignments, work entered. Read all articles, watched training
movies, searched online helps and digged news groups.
I desperately need a help for that. I will be happy if you can help me
or forward me to somewhere.
Best Regards
- 3
- Net Framework >> Nullable boolean true on webservice response comes across as nullHello all,
I'm working on a web app that we converted over to asp 2.0 recently and
here's the issue I ran into:
We use a java webservice to retrieve data and display this data to the user.
This was working in 1.1 and nothing changed around this particular webservice
call on either side after the switch to 2.0. The webservice response is an
array of value objects and the value object contains a boolean. I intercepted
the response with Fiddler and verified that the boolean was set to either
true or false on all the vo's in the array. But after the response object was
created and I could look at it in the code while debugging, the (nullable)
boolean field in every vo in the array was null.
To fix this temporarily, I had the webservice provider change the boolean
field to a 'NullableBoolean' class that contained a boolean value - this way,
the correct value came across and I could work with it.
I'm not sure if this is helpful, but there's one more detail I noticed -
The xml doc I intercepted with Fiddler looks something like this
('processed' is the boolean variable):
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"...>
<env:Body env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
...
<responseVos...>
...
<ResponseVo ...>
...
<processed href="#ID_4"/>
...
</ResponseVo>
...
</responseVos...>
...
<xsd:boolean xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xsi:type="xsd:boolean" id="ID_4">true</xsd:boolean>
...
</env:Body>
</env:Envelope>
This is working for now but I think I shouldn't have to have my webservice
provider fix my problem, right? Any help in solving this problem would be
greatly appreciated.
--
ak
- 4
- ADO >> Problem with disable msde connection poolHello,
To resotre MSDE database, the connection pool must be disabled. I set
pooling=false in the connection string, i.e.,
SqlConnection conn = new SqlConnection("server=(local)\\NetSDK;
database=mydb; uid=sa; password=abc; pooling=false;");
It seems that the connection pool was not disabled. Here are the error
messages I got:
[Microsoft][ODBC SQL Server Driver][SQL Server]Exclusive access could
not be obtained because the database is in use.
[Microsoft][ODBC SQL Server Driver][SQL Server]RESTORE DATABASE is
terminating abnormally.
Any ideas? Are there any other ways to disable the connection pool?
Any help would be appreciated!
Mandy
- 5
- Net Framework >> Assembly info file..Can I give a variable in the assembly info file?
Say like
<Assembly: AssemblyTitle(var1)>
var1 is a static variable in my project that is common for the project
VJ
- 6
- Winforms >> ListView.tag lost objectHi,
I have a Form with two ListViews; The ListViews are diplayed on the
Design surface, but I progmatically adding the items to each ListView.
When adding the items to the list view I am iterating through and
setting the following:
...
With myListViewItem
.Text = drArticles("Title").ToString
.ToolTipText = drArticles("Summary").tostring
.Tag = CType(drArticles("ID"),Guid)
End With
myListView.Items.Add
...
This works fine and the items are displayed.
The problem arises when I respond to a SelectedIndexChanged event I can
retrieve the .ToolTipText and .Text values from then
SelectedListViewItemCollection but the .tag property is always empty (it
knows the object type is GUID but does not have the value. I know the
value is being set as I can set the ToolTipText to same ID as the TAG
and it is stored correctly.
Any ideas?
Many thanks in advance
- 7
- Net Framework >> Having trouble deploying Custom User Control to a container ...If I develop a user control that is made from intrinsic windows controls such
as text box, etc, I can successfully deploy it to the the browser and see it
instantiated.
but if I add a third party control to the custom control, then I have
difficulty instantiating it.
I guess this has to do with .Net framework security.
I have done my best to change the security policies on the local computer to
allow the Custom User Control to run, but had no success.
I have dveloped and deployed the user control by following the steps
provided at the following URL:
http://www.c-sharpcorner.com/Code/2003/March/ActiveXInNet.asp
Is there any way I can develop a user control in .Net that includes a third
party control and instantiate into a container?
All helpful comments will be appreciated.
Thanks,
Mehran Sedaghatpour.
- 8
- Dotnet >> Composite UI application Block - Thread Safe?Does anyone have any input on setting up my CAB application so that the
application is thread safe, and cached appropiately? I read that this
can be managed through Services, and dynamic injection. On the
contrary, I was told that this can be handled using Enterprise Library
cached application block. Last, but not least, i read you can implement
this at the class level, creating immutable classes, and caching them
accordingly. Any suggestions would be greatly appreciated?
- 9
- Visual C#.Net >> Adding multiple enum itemsprobably simple but need quick answer if possible. How do I add multiple
enum values to a particular property
e.g. in Vb you would have added them (bit like)
myDataView.RowStateFilter = DataViewRowState.CurrentRows +
DataViewRowState.ModifiedOriginal;
Thanks in advance.
--
Br,
Mark Broadbent
mcdba , mcse+i
=============
- 10
- Visual C#.Net >> Access ModifiersHi,
Is it possible to declare a variable or array in the class that is
accessible to all the methods in the class? For the example below, I would
like to make the variable lnVar1 accessible to both methods m1 and m2 but I
am getting an error. Is there another way to do this?
Thanks
Roy
using System;
using System.Collections.Generic;
using System.Text;
namespace cClasses
{
class Program
{
static void Main(string[] args)
{
AA2.m1();
}
}
}
public class AA2
{
protected int lnVar1 = 0;
public static void m1()
{
Console.Write("M1 {0}", lnVar1);
}
public static void m2()
{
Console.Write("M2 {0}", lnVar1);
}
}
- 11
- Visual C#.Net >> Get the plain text from html stringI am wondering what is the fastest way to get plain text such as "abc def 12"
from an HTML string.
I can parse it, but not sure how to deal with those special characters, such
as & and >. Is there an API to get the right plain text?
TIA.
- 12
- Visual C#.Net >> Programmatically disabling Windows Control EventsHi
I wanted to programmatically disable events like SelectedIndexChanged without
using a boolean flag, which indeed I find a quick and dirty solution. So, I
found a
piece of code that do this more elegant:
* How to disable event in C#?
Link: http://tinyurl.com/alsge
Group: microsoft.public.dotnet.framework.compactframework
But I saw it is limited to ComboBoxes and to the SelectedIndexChanged Event
and
I want to generalize it to an object of type control and to every possible
event. To
give you an idea, I will post some of my ugly code:
public static EventHandler DisableSelectedIndexChanged(Control control)
{
FieldInfo fieldInfo;
object fieldObject;
EventHandler handler = null;
fieldInfo = control.GetType().GetField("SelectedIndexChanged",
BindingFlags.Instance | BindingFlags.NonPublic);
if (fieldInfo != null)
{
fieldObject = fieldInfo.GetValue(control);
if (fieldObject is EventHandler)
{
handler = (EventHandler)fieldObject;
//This is the part I want to avoid
if (control is ComboBox)
((ComboBox)control).SelectedIndexChanged -= handler;
else if (control is ListBox)
((ListBox)control).SelectedIndexChanged -= handler;
else if (control is ListView)
((ListView)control).SelectedIndexChanged -= handler;
else if (control is TabControl)
((TabControl)control).SelectedIndexChanged -= handler;
}
}
return handler;
}
Is it possible to avoid the casting and get a pointer to the
SelectedIndexChanged
property, then apply the -= operation over it? How? As I could understand,
FieldInfo.GetValue(control) only returns the handler, but not the
SelectedIndexChanged property.
Thanks in advanced,
Josef
- 13
- Dotnet >> Localized Exception Messages in WinFormsSystem exception messages in VS2005 are given in the local language.
Sometimes it is nice, but often it is quite inconvenient - try looking up
MSDN or Google with a localized message!
So, after having received a rather obtuse message concerning a P/Invoke
error, I spent some time getting rid of this unwanted feature, and I wish to
share with you the results.
First, my solution: In the Load event of the main form, add:
Thread.CurrentThread.CurrentUICulture = new
System.Globalization.CultureInfo ("en-US");
Now, the explanation:
Visual Studio Debugger, How to: Find Out More About an Exception with the
Exception Assistant says quite clearly:
"Message: Message associated with the exception. This is displayed in the
language specified by the CurrentUICulture property of the thread that
throws the exception."
So it is a feature, albeit not well considered.
Where does CurrentUICulture come from?
The help at NET Framework Class Library, Thread.CurrentUICulture Property,
advises:
Application.Run(new UICulture());
But this is wrong, Application.Run does not take a culture parameter, and
the Application.CurrentCulture property does not affect the behavior of the
exception assistant - CurrentCulture and CurrentUICulture are not the same
thing! CurrentUICulture is a property of the thread, and is not affected by
either of the application CurrentCulture or the assembly
NeutralResourcesLanguage attribute. It is the language specified in the
control panel regional and language options.
The assembly Culture attribute may not be used: "Information on the culture
or language the assembly supports. This information should be used only to
designate an assembly as a satellite assembly containing culture- or
language-specific information. (An assembly with culture information is
automatically assumed to be a satellite assembly.)"
So we are left with dynamically modifying the thread CurrentUICulture.
In development I can make it depend on #if DEBUG. But what if a user in
another country gets a system exception using my software? I will get the
error message in his language and what could I do with it?
See http://msmvps.com/blogs/calinoiu/archive/2006/06/30/103426.aspx
JR
- 14
- Visual C#.Net >> Adding Items to ComboboxI am using a C# combobox control. There are too many items to add right from
the start, I want to add 20 or so, then when the user cursors down to the
last one and cursors down again, I will add the next 20 so that they can
continue. Is there an event for when the user has reached the end of the list?
The only other was I can think of to handle it would be to capture each time
they pressed the up or down arrow, then see if the value changed, and if not,
add items. Is there not a better way than that? Thanks.
- 15
- Visual C#.Net >> BinaryReader munges dataI'm about to rip out what little hair I have left; I have a class that
uses a BinaryReader, and the data is getting munged. A subset of the
code follows; I've removed the parts that aren't relevant.
What's really strange is that it reads the file just fine until the
272nd call to the Read method of the class, at which point it begins
munging the data.
Any thoughts would be greatly appreciated; I've tried reading by byte,
as well as reading blocks, and it makes no difference.
-Kevin
public class HeaderStream
{
private const int c_BlockSize = 680;
private System.IO.BinaryReader str;
public HeaderStream(string path)
{
FileStream s = new FileStream(path,
FileMode.Open,
Read);
str = new BinaryReader(s);
}
public OWHeader Read()
{
byte[] buf = new byte[c_BlockSize];
int i;
i = str.Read(buf, 0, c_BlockSize);
if (i != c_BlockSize)
throw new EndOfStreamException(
String.Format(
"End of stream reached with bytes left to read"));
return new OWHeader(buf);
}
}
|
| Author |
Message |
Asary

|
ADO >> MSDE and TransactionScope
I have a C# application that applys a set of scripts to a database to create
the structures. When each script is applied, I encapsulate the call within a
TransactionScope. Everything works fine on SQL Server 2000 sp4, 2005 sp1,
and Express 2005 sp1 databases.
On MSDE2000 SP4, I consistently get transaction timeouts on my scripts.
However, it is never the same script. These are the same scripts I use on
other database, so I am confident that the scripts themselves are fine.
Everything is running locally on one machine. MSDTC is running. I've tried
restarting the services, restarting the machines, and connection pooling
seems to be ok, and I'm running out of ideas to check.
Has anyone had a similar experience or can recommend something to check?
- [System.Data.SqlClient.SqlException] {"Import of MSDTC transaction
failed: XACT_E_NOTRANSACTION."} System.Data.SqlClient.SqlException
Number 8509
DotNet251
|
| |
|
| |
 |
| |
 |
Index ‹ DotNet ‹ ADO |
- Next
- 1
- Visual C#.Net >> ArrayList.RemoveAt(i)Hi All,
I've done the same things for another array list like resetting the
datasource and its working fine but this time for a separate case i still
get the same error "index out of range"
And like before, the arraylist that is being binded is deleting correctly
from 4 items down to 3 etc. Do anyone have any ideas?
Thanks in advance
Alex Ting
""Jeffrey Tan[MSFT]"" <v-jetan@online.microsoft.com> wrote in message
news:Y8BBI8DpDHA.1544@cpmsftngxa06.phx.gbl...
>
> Hi Alex,
>
> You should set DataGridTableStyle's MappingName to "ArrayList", then set
> DataGridColumnStyle's MappingName to Arraylist's public property.
> When deleting the arraylist member, you should refer to the
> CurrencyManager(Manages the collection of BindingManagerBase objects )
> which can get from BindingContext item.
> You should decrease CurrencyManager.Position property.
> Then, you can delete an item of arraylist and update the CurrencyManager.
>
> There is a sample project(You should download the entire project from a
> link in this article) in the post I last replied you. It provides you a
> detailed implementation of operating the Arraylist databinding. This
sample
> project works well on my machine, and I think it will meet your need
>
> Best regards,
> Jeffrey Tan
> Microsoft Online Partner Support
> Get Secure! - www.microsoft.com/security
> This posting is provided "as is" with no warranties and confers no rights.
>
> --------------------
> | From: "Alex Ting" <ating@learningfast.com>
> | References: <OaUw5A3nDHA.392@TK2MSFTNGP11.phx.gbl>
> <MhzPQQ3oDHA.2624@cpmsftngxa06.phx.gbl>
> | Subject: Re: ArrayList.RemoveAt(i)
> | Date: Thu, 6 Nov 2003 13:34:30 +1100
> | Lines: 285
> | X-Priority: 3
> | X-MSMail-Priority: Normal
> | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
> | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
> | Message-ID: <e81VU6ApDHA.964@TK2MSFTNGP10.phx.gbl>
> | Newsgroups: microsoft.public.dotnet.languages.csharp
> | NNTP-Posting-Host: learningfast2.learnfast.monash.edu.au 130.194.247.2
> | Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
> | Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.languages.csharp:197066
> | X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
> |
> | Hi Jeff,
> |
> | Thanks for your reply.
> |
> | the getQuestions simply returns the arrayList
> |
> | public Learningfast.QGM.QuizList getQuestions()
> |
> | {
> |
> | return this.myQuestions;
> |
> | }
> |
> | The mapping name is set to this but this is still not working. I even
set
> | the mapping name to "ArrayList" but to no avail.
> |
> | Thanks in advance.
> |
> | Alex Ting
> |
> |
> | ""Jeffrey Tan[MSFT]"" <v-jetan@online.microsoft.com> wrote in message
> | news:MhzPQQ3oDHA.2624@cpmsftngxa06.phx.gbl...
> | >
> | > Hi Alex,
> | >
> | > Sorry for letting you wait for so long time.
> | > I think your code snipet is not integrated. There is nothing code
> related
> | > to getQuestions() method.
> | > But I still can give you some suggestion.
> | > For datagrid to bind to the arraylist, you should set the MappingName
> | > property to "ArrayList" not others. This rule can be found in MSDN
> | document
> | > in DataGrid(WinForm).
> | > I think if you set the correct binding, the datagrid will reflect the
> | > source arraylist correctly.
> | >
> | > For a sample of how to bind arraylist to datagrid, you can refer to:
> | > http://www.syncfusion.com/FAQ/WinForms/FAQ_c43c.asp#q818q
> | >
> | > If you still have anything unclear, please feel free to let me know.
> | >
> | > Best regards,
> | > Jeffrey Tan
> | > Microsoft Online Partner Support
> | > Get Secure! - www.microsoft.com/security
> | > This posting is provided "as is" with no warranties and confers no
> rights.
> | >
> | > --------------------
> | > | From: "Alex Ting" <ating@learningfast.com>
> | > | Subject: ArrayList.RemoveAt(i)
> | > | Date: Fri, 31 Oct 2003 16:30:57 +1100
> | > | Lines: 201
> | > | X-Priority: 3
> | > | X-MSMail-Priority: Normal
> | > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
> | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
> | > | Message-ID: <OaUw5A3nDHA.392@TK2MSFTNGP11.phx.gbl>
> | > | Newsgroups: microsoft.public.dotnet.languages.csharp
> | > | NNTP-Posting-Host: learningfast2.learnfast.monash.edu.au
130.194.247.2
> | > | Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP11.phx.gbl
> | > | Xref: cpmsftngxa06.phx.gbl
> | microsoft.public.dotnet.languages.csharp:195620
> | > | X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
> | > |
> | > | Hi Everybody,
> | > |
> | > | I have an issue about deleting an object from an arrayList.
> | > |
> | > | I've bounded a datagrid using this code
> | > | where it will first run through all of the code in loadQuestions()
and
> | > bind
> | > | a arrayList to the datagrid.
> | > |
> | > | private void BindQuestions()
> | > |
> | > | {
> | > |
> | > | dataGridQuestions.DataSource= this.AppQuiz.getQuestions();
> | > |
> | > | this.toolBarBtnSave.Enabled=true;
> | > |
> | > | this.toolBarBtnDel.Enabled=true;
> | > |
> | > | }
> | > |
> | > |
> | > |
> | > | public void loadQuestions()
> | > |
> | > | {
> | > |
> | > | this.BindQuestions();//this.AppQuiz.getQuestions();//AppQuiz();
> | > |
> | > | if(this.DataGridSet==false)
> | > |
> | > | {
> | > |
> | > | DataGridTableStyle gs = new DataGridTableStyle(); // gs =
Grid
> | > Style
> | > |
> | > |
> | > | gs.MappingName = AppQuiz.getQuestions().GetType().Name;
> | > | //dummyDataArr.GetType().Name;
> | > |
> | > | gs.AllowSorting = true;
> | > |
> | > | gs.AlternatingBackColor = System.Drawing.Color.AntiqueWhite;
> | > |
> | > |
> | > | DataGridTextBoxColumn cs2 = new DataGridTextBoxColumn();
> | > |
> | > | cs2.MappingName = "QuestionID";
> | > |
> | > | cs2.HeaderText = "No.";
> | > |
> | > | cs2.Alignment = HorizontalAlignment.Left;
> | > |
> | > | cs2.Width = 33;
> | > |
> | > | cs2.ReadOnly = true;
> | > |
> | > |
> | > | gs.GridColumnStyles.Add(cs2);
> | > |
> | > |
> | > | DataGridBoolColumn cs = new DataGridBoolColumn(); // cs =
> Column
> | > | Style
> | > |
> | > | cs.MappingName = "Publish";
> | > |
> | > | cs.HeaderText = "Publish";
> | > |
> | > | cs.Width = 75;
> | > |
> | > | gs.GridColumnStyles.Add(cs);
> | > |
> | > | cs = new DataGridBoolColumn();
> | > |
> | > | cs.MappingName = "Required";
> | > |
> | > | cs.HeaderText = "Mandatory";
> | > |
> | > | cs.Width = 75;
> | > |
> | > | cs2.ReadOnly = true;
> | > |
> | > | gs.GridColumnStyles.Add(cs);
> | > |
> | > | cs2 = new DataGridTextBoxColumn();
> | > |
> | > | cs2.MappingName = "QuestionType";
> | > |
> | > | cs2.HeaderText = "Question Type";
> | > |
> | > | cs2.Alignment = HorizontalAlignment.Center;
> | > |
> | > | cs2.Width = 80;
> | > |
> | > | cs2.ReadOnly = true;
> | > |
> | > | gs.GridColumnStyles.Add(cs2);
> | > |
> | > | cs2 = new DataGridTextBoxColumn();
> | > |
> | > | cs2.MappingName = "Ask";
> | > |
> | > | cs2.HeaderText = "Question";
> | > |
> | > | cs2.Alignment = HorizontalAlignment.Left;
> | > |
> | > | cs2.Width = 255;
> | > |
> | > | cs2.ReadOnly = true;
> | > |
> | > | gs.GridColumnStyles.Add(cs2);
> | > |
> | > | dataGridQuestions.TableStyles.Add(gs);
> | > |
> | > |
> | > | }
> | > |
> | > | panelDgQuestions.Show();
> | > |
> | > | panelSplash.Hide();
> | > |
> | > | }
> | > |
> | > |
> | > |
> | > | And then after that, they can delete a row from the datagrid. Then
> this
> | > | function is called
> | > |
> | > |
> | > |
> | > | /// <summary>
> | > |
> | > | /// this will remove the questions and then shuffle up all the
> questions
> | > | after it
> | > |
> | > | /// </summary>
> | > |
> | > | /// <param name="questionID">question ID to remove</param>
> | > |
> | > | public void removeAndShuffle(int questionID)
> | > |
> | > | {
> | > |
> | > | for(int i=0; i< this.myQuestions.Count; i++)
> | > |
> | > | {
> | > |
> | > |
> | if(((Learningfast.QGM.Question)this.myQuestions[i]).QuestionID
> | > | == questionID)
> | > |
> | > | {
> | > |
> | > | this.myQuestions.RemoveAt(i);
> | > |
> | > | }
> | > |
> | > | }
> | > |
> | > | }
> | > |
> | > |
> | > |
> | > | In debug mode, for example if there were 2 rows, it is now 1 row and
> | > | everything seems fine, but when i rebind the datagrid with the
> arraylist
> | > | after an object has been removed,
> | > |
> | > | private void BindQuestions()
> | > |
> | > | {
> | > |
> | > | dataGridQuestions.DataSource= this.AppQuiz.getQuestions();
> | > |
> | > | this.toolBarBtnSave.Enabled=true;
> | > |
> | > | this.toolBarBtnDel.Enabled=true;
> | > |
> | > | }
> | > |
> | > | Mind you it does not run through the initializing statements of the
> | > | datagrid, it just rebinds the datasource. And then at this point
when
> | the
> | > | datagrid is meant to be displayed, it gives me an error index [index
> | > number
> | > | that was deleted] is out of bounds.
> | > |
> | > | Can someone please tell me whats happening? I've read up in several
> | cases
> | > | and usually this means that I'm trying to bring up the object that
was
> | > | deleted but I'm just changing the datasource to the amended
arraylist.
> | > Could
> | > | this have to do with my existing datagrid where i'm not initializing
> it
> | > | again? because I've tried that and it also brings up an error saying
> | that
> | > | i'm using the same "mapping name"
> | > |
> | > | Thanks in advance.
> | > |
> | > | Kind Regards
> | > |
> | > | Alex Ting
> | > |
> | > |
> | > | ---
> | > | Outgoing mail is certified Virus Free.
> | > | Checked by AVG anti-virus system (http://www.grisoft.com).
> | > | Version: 6.0.532 / Virus Database: 326 - Release Date: 27/10/2003
> | > |
> | > |
> | > |
> | >
> |
> |
> | ---
> | Outgoing mail is certified Virus Free.
> | Checked by AVG anti-virus system (http://www.grisoft.com).
> | Version: 6.0.536 / Virus Database: 331 - Release Date: 3/11/2003
> |
> |
> |
>
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.542 / Virus Database: 336 - Release Date: 18/11/2003
- 2
- ADO >> about typed datasets (conceptual question)hi ,
I am using ado.net with typed datasets and typed datatables
my question is about how to handle child / parent type tables with datasets.
For instance say that I have 2 tables with columns :
table Topic: (parent table)
TopicId
TopicName
CreateDate
table Message : (child table)
MessageId
TopicId
Message
CreateDate
When I need to use these 2 tables from the asp.net code I am using
databinding to bind data to a datagrid
My problem starts here because :
When I need these two tables in joined way . (say that I am listing messages
in the datagrid and I need TopicName in each row)
In classic way , it is easy join these two tables and write the necessary
databinding code.
select Message.*, Topic.TopicName from Message inner join Topic on
Message.TopicId=Topic.TopicId
But when I use typed datasets How should I fill these two tables ? ( You
can say that fill these 2 tables seperately but what if I need only the
TopicName column ? isn't it a performance decrease for the system ? do I
have to ignore it ? ) Also I would like to benefit from typed dataset
architecture.
Is there any good document or web page address about this issue ? How should
I write stored procedures ?
- 3
- Winforms >> How can one select from overlapped panels in the form design View?I am building a Windows Form App that has a splitter in the client area,
treeview on the left, and panels on the right. Different classes of tree
nodes need different views. How can I cause the one I want to work on (say
add or remove a control) to pop to the top of the z order in the design
view? I have tried about everything I can think of, without success. Bring
to top and send to bottom do not seem to do what I expect. Google revealed
nothing. Any help would be much appreciated.
- 4
- Net Framework >> EMBEDDING images - System.Web.MailHi, I hope there is someone reading this that has the answer, Please Help!
I have the need to send a html email via asp.net. its easy enough to send
an html email and add attachments.
My question is, how to you set the Content-Location of each attachment in
the mail headers so that the images are embedded in the html email rather
than attached?
This is my code:
private void Page_Load(object sender, System.EventArgs e)
{
MailMessage objEmail = new MailMessage();
objEmail.From = aspnet@domain.com;
objEmail.Subject = "news flash ";
string body = "<html>.....
{some html code with images as <img src=\"news_r1_c1.jpg\"> ... etc
</html>";
objEmail.Body = body;
objEmail.Priority = MailPriority.Normal;
objEmail.BodyFormat = MailFormat.Html;
MailAttachment i1 = new
MailAttachment(Server.MapPath("images/news_r1_c1.jpg"));
MailAttachment i2 = new
MailAttachment(Server.MapPath("images/news_r1_c3.gif"));
MailAttachment i3 = new
MailAttachment(Server.MapPath("images/spacer.gif"));
MailAttachment i4 = new
MailAttachment(Server.MapPath("images/news_r4_c1.jpg"));
MailAttachment picture = new
MailAttachment(Server.MapPath("images/default.jpg"));
objEmail.Attachments.Add(i1);
objEmail.Attachments.Add(i2);
objEmail.Attachments.Add(i3);
objEmail.Attachments.Add(i4);
objEmail.Attachments.Add(picture);
string sendto = Request.Form["recipients"];
string[] recipients= sendto.Split(',',';');
foreach(string recipient in recipients)
{
objEmail.To = recipient.Trim();
SmtpMail.SmtpServer = "smtp.server,com";
try
{
SmtpMail.Send(objEmail);
}
catch (Exception exc)
{
Response.Write("Send failure: " + exc.ToString());
}
}
}
as said, html email is coming through fine, images are in email as
Attachments, but DON'T display inline with the page (even though the
attachments are named correctly corresponding to the image names in the HTML
(<img src="imagename.jpg"> where imagename.jpg is attached).
I have sent HTML emails with embedded images in Classic ASP using CDONTS
quite easily, i need to do the same in .NET!
[FYI code to attach in ASP is:
objMail.AttachURL server.MapPath("images/imagename.jpg"), "imagename.jpg"
]
a quick look at the message source shows this at the top of the part that
holds the binary information about the image, in the email source:
for the ASP version (that works) :
------=_NextPart_000_000A_01C3EF89.62C8CA30
Content-Type: image/jpeg
Content-Transfer-Encoding: base64
Content-Disposition: attachment
Content-Location: news_r1_c1.jpg
in the ASP.NET version (doesn't show images inline)
------=_NextPart_000_005D_01C3F184.ECF34990
Content-Type: image/jpeg;
name="news_r1_c1.jpg"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="news_r1_c1.jpg"
notice how there is no Content-Location with the image name in the .NET
version, this is obviously needed to tell the mail client where the attached
images should be displayed in the HTML email.
Now does anyone know how to set this in the .NET mail object??
any help/leads in the right direction are appreciated.
The doesn't seem to be anywhere to set this property in the MailAttachment,
or MailAttachments.Add methods, and i couldn't find any answers in the docs
Please help
Thanks
Tim
PS. (although i'm using c#, vb code will do if you code in VB.NET)
- 5
- Visual C#.Net >> KeyPreview now useable? (VS 2005)I have always found the form-level KeyPreview feature near useless, as
there was a bug that allowed ComboBoxes to ignore it. In VS 2005 I've
confirmed that it now woks in Combos. Is there anything else to be
concerned about, or can we now use this to our heart's content when we
want to pre-process input?
Bob
- 6
- Net Framework >> Timer control vs Timer classI included a timer control in my C# project, I got the following 2 events
1. Disposed
2. Tick
I included the timer class programatically in the same C# project and I got
the following events
1. Disposed
2. Elapsed
I am stumped..:-( whats going on here? I have framework 1.1 with VS.NET
2003
VJ
- 7
- Net Framework >> Short display for long filenamesHello,
as most of you know, some programs that handle files have a "recent files"
feature, that is mostly a menu item within the file menu that shows the
last documents the user had opened. Visual studio .net gives you an
example.
This example shows as well that long filenames will be displayed shortened
to fit the menu item, e.g.
C:\Documents and settings\John Doe\My files\XYZ\document.xyz
might be displayed as
C:\Documents and settings\ ... \XYZ\document.xyz
As I would like to have this feature in my own brilliant and amazing
helloWorld-application, too, I'm wondering if there isn't a function in
the .net framework that returns the shorter version of a full path that
exceeds a specified length.
Of course, it is possible - actually for me - to parse the string for
myself, but I would not like to reinvent the wheel.
Just to prevent misunderstandings: I don't mean that kind of short filenames
returned by the GetShortPathName-API-function like "C:\Documn~1\John~1" ...
So: Did I overlook something in the .net documentation?
Regards Daniel
--
http://www.bolege.de
E-mails to specified address will NOT be read.
Please use db[at]bolege[dot]de instead.
- 8
- Dotnet >> PDF's Internet Explorer 7Ever since I installed IE 7 PDF's on several web sites do not appear for me
to print or download. Is there a setting I need to adjust. This happens only
on a few web sites
- 9
- Visual C#.Net >> Microsoft Visual C# 2005 - missing watch windowCould anyone tell me why I cannot bring up the watch window. MS help
says its there but no matter what I do, I cannot find any settings to
enable this debug missing menu item. Searched Google, asked others and
one other said he could not find it either. Usually MS says that you
need enterprise or whatever if a feature is missing but in this case
there is no comments - it just should be there!
Thanks,
Alistair.
- 10
- ADO >> Ideas on storing and retriving files in a Windows ApplicationI'm looking for some ideas, I have a project to complete that has a
requirement to store just about ANY type of document. Most common documents
include Word, Excel, HTML, images, pdf, media files, etc. I was thinking of
storing these into SQL Server 2000 as image type but my delimma lays with
retrieval. I was thinking of using a Microsoft Web Browser control to
display the item to the user. This works ok for 2 reasons, 1. The browser
will open the appropiatte application to display the file and 2. I can just
use the Navigate(2) method to display the item. The problem with this I
don't want the requirement of storing the item to a file (filestream) before
displaying (Navigate needs somewhere to go). I was thinking of memoryStream
but I see no good examples (other than image files) on how to do this,
espcially on how to handle large files. Is this a good approach? Or should
I just stick with files stored on the server?
THANKS
--
Ken Beard
MCSD, MCP
- 11
- Visual C#.Net >> CollectionBase in Net1.1 and Collection in Net 2.0Hi,
I have some collections that inherit from CollectionBase in Net 1.1
In these collection I override the OnRemove, OnRemoveComplete, ...
I would like to to move them in Net 2.0 but in this version these protected
methods don't exist
What is the best way?
Thank's in advance
- 12
- Dotnet >> Formating a text boxI am being very dumb... I am coverting an invoice value to a decimal and
displaying the result on a VB.net 2003 form. However, I only want to display
the result to 2 decimal places and I am struggling to it - sorry for such an
easy question!
Can somebody advice me how to achieve this?
--
Thanks
Bill Partridge
- 13
- ADO >> nvarchar Sql data typeHi
If the table column is defined as folows:
FullName nvarchar 20
Does this let me add a string of maximume 20 characters? or is it limited to
20 bytes length?
Thanks,
Ronen
- 14
- ADO >> NewRowBuilderHi,
We want different row types at the same time in a DataTable. The idea behind
this is to support a kind of inheritance in a table. To do this, we had
overridden the NewRowFromBuilder method. Then we select the row type
construction using a special column that contains the type of the database
record type. All row type inherit from DataRow, but they have a common set
of columns and additional columns according to each type. Top base class is
TPersons
TCustomers and TEmployees inherit from TPersons
TSpecializedCustomers inherits from TCustomers.
Actually we have succeeded using the following code at the Fill time. When
we the Merge and the GetChanges method, will get the following message "This
row has been removed from a table and does not have any data. BeginEdit()
will allow creation of new data in this row." at the line A. I know that
methods called by Fill are not the same as the GetChanges method.
protected override DataRow NewRowFromBuilder(DataRowBuilder builder) {
TPersonsRow newBaseRow = new TPersonsRow(builder);
(A) string RowType = (string)newBaseRow[columnRXClassType];
if (RowType == "TEmployees") { return new TEmployeesRow(builder); }
if (RowType == "TCustomers") { return new TCustomersRow(builder); }
if (RowType == "TSpecializedCustomers") { return new
TSpecializedCustomersRow(builder); }
return newBaseRow;
}
I just want a idea of how I can overcome this issue. We already did
implement the same concept in earlier version of ADO and now we are trying
to migrate to ADO.NET. But we are not sure, the thing is we cannot migrate
if we cannot support inheritance like we have already done.
Thanks!
- 15
- ADO >> GUIDsThis is a multi-part message in MIME format.
------=_NextPart_000_0114_01C3B8DB.576D5F00
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
I usually use numerics with a random number generator for my unique ID =
fields in my tables, however I have an instance where I would like to =
use GUIDs (since this key will never be used or seen by the end user). =
Here is the start of my code:
Dim myGuid1 As New Guid()
JrEventID =3D myGuid1.ToString
txtEventID.Text =3D JrEventID
How do I generate a new GUID? Is is a simple process?
Thanks for the information.
Brad
------=_NextPart_000_0114_01C3B8DB.576D5F00
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1276" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>I usually use numerics with a random =
number=20
generator for my unique ID fields in my tables, however I have an =
instance where=20
I would like to use GUIDs (since this key will never be used or seen by =
the end=20
user). Here is the start of my code:</FONT></DIV>
<DIV>
<P><FONT face=3DArial size=3D2> Dim myGuid1 As New=20
Guid()</FONT></P>
<P><FONT face=3DArial size=3D2> JrEventID =3D=20
myGuid1.ToString</FONT></P>
<P><FONT face=3DArial size=3D2> txtEventID.Text =3D=20
JrEventID</FONT></P>
<P><FONT face=3DArial size=3D2>How do I generate a new GUID? Is is =
a simple=20
process?</FONT></P>
<P><FONT face=3DArial size=3D2>Thanks for the information.</FONT></P>
<P><FONT face=3DArial size=3D2>Brad</FONT></P></DIV></BODY></HTML>
------=_NextPart_000_0114_01C3B8DB.576D5F00--
|
|
|