472,802 Members | 1,465 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,802 software developers and data experts.

cannot implicitly convert type object to string

Hi,

I am receiving the error when compiling the project, "cannot implicitly
convert type object to string".

The error points to this line of code and underlines the
dtrRecipient["Email"]: objMailMessage.To = dtrRecipient["Email"];

I'm not sure why I am getting this error. Below is the complete code I am
working with.

private void EmailEm()
{
string intSelectedEmail = ddlChooseEmail.SelectedValue.ToString();
string sqlGetEmail = "SELECT content, subject FROM tblContent WHERE id =
" + intSelectedEmail;
SqlCommand cmdGetEmail = new SqlCommand(sqlGetEmail, strConnString);
SqlDataReader dtrEmail = cmdGetEmail.ExecuteReader();

string intSelectedGroup = chkGroups.SelectedValue.ToString();
string sqlRECIPIENTS = "SELECT tblRecipients.Email AS Email FROM tblGR
INNER JOIN tblRecipients ON tblGR.RecipientID = tblRecipients.ID WHERE
tblGR.GroupID=" + intSelectedGroup;
SqlCommand cmdSelect = new SqlCommand( sqlRECIPIENTS, strConnString );
SqlDataReader dtrRecipient = cmdSelect.ExecuteReader();

MailMessage objMailMessage;

while (dtrRecipient.Read())
{
// Create the Mail Message
objMailMessage = new MailMessage();
objMailMessage.From = "";
objMailMessage.To = dtrRecipient["Email"];
objMailMessage.Subject = dtrEmail["Subject"];
objMailMessage.Body = dtrEmail["Content"];

// Send the Mail Message
SmtpMail.Send( objMailMessage );
}
}
Thanks,

Andy
Nov 19 '05 #1
9 10454
Andy,
You simply can covert something of type System.Object to something of type
System.String. The "Email" column might be a varchar, but dr["xxx"] always
returns an object. you must Convert it to the type you wish:

objMailMessage.To = Convert.ToString(dtrRecipient["Email"]);

If you were using vb before, you could get away from doing this by having
Option Strict Off - but then your in for all sorts of trouble..

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Andy Sutorius" <an**@sutorius.com> wrote in message
news:6z*********************@twister.southeast.rr. com...
Hi,

I am receiving the error when compiling the project, "cannot implicitly
convert type object to string".

The error points to this line of code and underlines the
dtrRecipient["Email"]: objMailMessage.To = dtrRecipient["Email"];

I'm not sure why I am getting this error. Below is the complete code I am
working with.

private void EmailEm()
{
string intSelectedEmail = ddlChooseEmail.SelectedValue.ToString();
string sqlGetEmail = "SELECT content, subject FROM tblContent WHERE id = " + intSelectedEmail;
SqlCommand cmdGetEmail = new SqlCommand(sqlGetEmail, strConnString);
SqlDataReader dtrEmail = cmdGetEmail.ExecuteReader();

string intSelectedGroup = chkGroups.SelectedValue.ToString();
string sqlRECIPIENTS = "SELECT tblRecipients.Email AS Email FROM tblGR
INNER JOIN tblRecipients ON tblGR.RecipientID = tblRecipients.ID WHERE
tblGR.GroupID=" + intSelectedGroup;
SqlCommand cmdSelect = new SqlCommand( sqlRECIPIENTS, strConnString );
SqlDataReader dtrRecipient = cmdSelect.ExecuteReader();

MailMessage objMailMessage;

while (dtrRecipient.Read())
{
// Create the Mail Message
objMailMessage = new MailMessage();
objMailMessage.From = "";
objMailMessage.To = dtrRecipient["Email"];
objMailMessage.Subject = dtrEmail["Subject"];
objMailMessage.Body = dtrEmail["Content"];

// Send the Mail Message
SmtpMail.Send( objMailMessage );
}
}
Thanks,

Andy

Nov 19 '05 #2
Let me guess: You used to be a VB programmer, right?

When you use the indexer for a SqlDataReader, you are invoking the "Item"
method, which returns a type of "Object." As an object is not a string, you
can't simply assign it to a string. That would be an implicit conversion.
You have to either do an explicit conversion (using Convert) or, better yet,
use the approproate SqlDataReader methods for getting the correct type of
data out of the row, such as .GetString().

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

"Andy Sutorius" <an**@sutorius.com> wrote in message
news:6z*********************@twister.southeast.rr. com...
Hi,

I am receiving the error when compiling the project, "cannot implicitly
convert type object to string".

The error points to this line of code and underlines the
dtrRecipient["Email"]: objMailMessage.To = dtrRecipient["Email"];

I'm not sure why I am getting this error. Below is the complete code I am
working with.

private void EmailEm()
{
string intSelectedEmail = ddlChooseEmail.SelectedValue.ToString();
string sqlGetEmail = "SELECT content, subject FROM tblContent WHERE id =
" + intSelectedEmail;
SqlCommand cmdGetEmail = new SqlCommand(sqlGetEmail, strConnString);
SqlDataReader dtrEmail = cmdGetEmail.ExecuteReader();

string intSelectedGroup = chkGroups.SelectedValue.ToString();
string sqlRECIPIENTS = "SELECT tblRecipients.Email AS Email FROM tblGR
INNER JOIN tblRecipients ON tblGR.RecipientID = tblRecipients.ID WHERE
tblGR.GroupID=" + intSelectedGroup;
SqlCommand cmdSelect = new SqlCommand( sqlRECIPIENTS, strConnString );
SqlDataReader dtrRecipient = cmdSelect.ExecuteReader();

MailMessage objMailMessage;

while (dtrRecipient.Read())
{
// Create the Mail Message
objMailMessage = new MailMessage();
objMailMessage.From = "";
objMailMessage.To = dtrRecipient["Email"];
objMailMessage.Subject = dtrEmail["Subject"];
objMailMessage.Body = dtrEmail["Content"];

// Send the Mail Message
SmtpMail.Send( objMailMessage );
}
}
Thanks,

Andy

Nov 19 '05 #3
Guilty of being a vb programmer :-)

Thanks to both of you for your help!

Andy
"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:uK**************@tk2msftngp13.phx.gbl...
Let me guess: You used to be a VB programmer, right?

When you use the indexer for a SqlDataReader, you are invoking the "Item"
method, which returns a type of "Object." As an object is not a string, you can't simply assign it to a string. That would be an implicit conversion.
You have to either do an explicit conversion (using Convert) or, better yet, use the approproate SqlDataReader methods for getting the correct type of
data out of the row, such as .GetString().

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Neither a follower nor a lender be.

"Andy Sutorius" <an**@sutorius.com> wrote in message
news:6z*********************@twister.southeast.rr. com...
Hi,

I am receiving the error when compiling the project, "cannot implicitly
convert type object to string".

The error points to this line of code and underlines the
dtrRecipient["Email"]: objMailMessage.To = dtrRecipient["Email"];

I'm not sure why I am getting this error. Below is the complete code I am working with.

private void EmailEm()
{
string intSelectedEmail = ddlChooseEmail.SelectedValue.ToString();
string sqlGetEmail = "SELECT content, subject FROM tblContent WHERE id = " + intSelectedEmail;
SqlCommand cmdGetEmail = new SqlCommand(sqlGetEmail, strConnString);
SqlDataReader dtrEmail = cmdGetEmail.ExecuteReader();

string intSelectedGroup = chkGroups.SelectedValue.ToString();
string sqlRECIPIENTS = "SELECT tblRecipients.Email AS Email FROM tblGR
INNER JOIN tblRecipients ON tblGR.RecipientID = tblRecipients.ID WHERE
tblGR.GroupID=" + intSelectedGroup;
SqlCommand cmdSelect = new SqlCommand( sqlRECIPIENTS, strConnString );
SqlDataReader dtrRecipient = cmdSelect.ExecuteReader();

MailMessage objMailMessage;

while (dtrRecipient.Read())
{
// Create the Mail Message
objMailMessage = new MailMessage();
objMailMessage.From = "";
objMailMessage.To = dtrRecipient["Email"];
objMailMessage.Subject = dtrEmail["Subject"];
objMailMessage.Body = dtrEmail["Content"];

// Send the Mail Message
SmtpMail.Send( objMailMessage );
}
}
Thanks,

Andy


Nov 19 '05 #4
Doesn't .GetString() require an ordinal position, which, in my opinion
wouldn't make it a "better" choice, just an alternative one with its own
pros and cons

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:uK**************@tk2msftngp13.phx.gbl...
Let me guess: You used to be a VB programmer, right?

When you use the indexer for a SqlDataReader, you are invoking the "Item"
method, which returns a type of "Object." As an object is not a string, you can't simply assign it to a string. That would be an implicit conversion.
You have to either do an explicit conversion (using Convert) or, better yet, use the approproate SqlDataReader methods for getting the correct type of
data out of the row, such as .GetString().

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Neither a follower nor a lender be.

"Andy Sutorius" <an**@sutorius.com> wrote in message
news:6z*********************@twister.southeast.rr. com...
Hi,

I am receiving the error when compiling the project, "cannot implicitly
convert type object to string".

The error points to this line of code and underlines the
dtrRecipient["Email"]: objMailMessage.To = dtrRecipient["Email"];

I'm not sure why I am getting this error. Below is the complete code I am working with.

private void EmailEm()
{
string intSelectedEmail = ddlChooseEmail.SelectedValue.ToString();
string sqlGetEmail = "SELECT content, subject FROM tblContent WHERE id = " + intSelectedEmail;
SqlCommand cmdGetEmail = new SqlCommand(sqlGetEmail, strConnString);
SqlDataReader dtrEmail = cmdGetEmail.ExecuteReader();

string intSelectedGroup = chkGroups.SelectedValue.ToString();
string sqlRECIPIENTS = "SELECT tblRecipients.Email AS Email FROM tblGR
INNER JOIN tblRecipients ON tblGR.RecipientID = tblRecipients.ID WHERE
tblGR.GroupID=" + intSelectedGroup;
SqlCommand cmdSelect = new SqlCommand( sqlRECIPIENTS, strConnString );
SqlDataReader dtrRecipient = cmdSelect.ExecuteReader();

MailMessage objMailMessage;

while (dtrRecipient.Read())
{
// Create the Mail Message
objMailMessage = new MailMessage();
objMailMessage.From = "";
objMailMessage.To = dtrRecipient["Email"];
objMailMessage.Subject = dtrEmail["Subject"];
objMailMessage.Body = dtrEmail["Content"];

// Send the Mail Message
SmtpMail.Send( objMailMessage );
}
}
Thanks,

Andy


Nov 19 '05 #5
> Doesn't .GetString() require an ordinal position, which, in my opinion
wouldn't make it a "better" choice, just an alternative one with its own
pros and cons
Well, Karl, I'm sure that's debateable. Yes, it does require an Ordinal
position, and I generally use it with GetOrdinal(), as in:

objMailMessage.To =
dtrRecipient.GetString(dtrRecipient.GetOrdinal("Em ail"));

If you're going to use the same column more than once, you can set an
integer variable for the ordinal to save some cycles.

As an old C programmer, I tend to avoid anything that works with Object.
However, on reflection, I couldn't say for sure which was more efficient at
run-time. I would think that Conversion functions have higher overhead, but
I have no proof.
Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:OB*************@TK2MSFTNGP15.phx.gbl... Doesn't .GetString() require an ordinal position, which, in my opinion
wouldn't make it a "better" choice, just an alternative one with its own
pros and cons

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:uK**************@tk2msftngp13.phx.gbl...
Let me guess: You used to be a VB programmer, right?

When you use the indexer for a SqlDataReader, you are invoking the "Item"
method, which returns a type of "Object." As an object is not a string,

you
can't simply assign it to a string. That would be an implicit conversion.
You have to either do an explicit conversion (using Convert) or, better

yet,
use the approproate SqlDataReader methods for getting the correct type of
data out of the row, such as .GetString().

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Neither a follower nor a lender be.

"Andy Sutorius" <an**@sutorius.com> wrote in message
news:6z*********************@twister.southeast.rr. com...
> Hi,
>
> I am receiving the error when compiling the project, "cannot implicitly
> convert type object to string".
>
> The error points to this line of code and underlines the
> dtrRecipient["Email"]: objMailMessage.To = dtrRecipient["Email"];
>
> I'm not sure why I am getting this error. Below is the complete code I am > working with.
>
> private void EmailEm()
> {
> string intSelectedEmail = ddlChooseEmail.SelectedValue.ToString();
> string sqlGetEmail = "SELECT content, subject FROM tblContent WHERE
> id = > " + intSelectedEmail;
> SqlCommand cmdGetEmail = new SqlCommand(sqlGetEmail, strConnString);
> SqlDataReader dtrEmail = cmdGetEmail.ExecuteReader();
>
> string intSelectedGroup = chkGroups.SelectedValue.ToString();
> string sqlRECIPIENTS = "SELECT tblRecipients.Email AS Email FROM
> tblGR
> INNER JOIN tblRecipients ON tblGR.RecipientID = tblRecipients.ID WHERE
> tblGR.GroupID=" + intSelectedGroup;
> SqlCommand cmdSelect = new SqlCommand( sqlRECIPIENTS,
> strConnString );
> SqlDataReader dtrRecipient = cmdSelect.ExecuteReader();
>
> MailMessage objMailMessage;
>
> while (dtrRecipient.Read())
> {
> // Create the Mail Message
> objMailMessage = new MailMessage();
> objMailMessage.From = "";
> objMailMessage.To = dtrRecipient["Email"];
> objMailMessage.Subject = dtrEmail["Subject"];
> objMailMessage.Body = dtrEmail["Content"];
>
> // Send the Mail Message
> SmtpMail.Send( objMailMessage );
> }
> }
>
>
> Thanks,
>
> Andy
>
>



Nov 19 '05 #6
On Tue, 22 Feb 2005 09:03:44 -0500, "Kevin Spencer"
<ke***@DIESPAMMERSDIEtakempis.com> wrote:
Doesn't .GetString() require an ordinal position, which, in my opinion
wouldn't make it a "better" choice, just an alternative one with its own
pros and cons


Well, Karl, I'm sure that's debateable. Yes, it does require an Ordinal
position, and I generally use it with GetOrdinal(), as in:

objMailMessage.To =
dtrRecipient.GetString(dtrRecipient.GetOrdinal("E mail"));

If you're going to use the same column more than once, you can set an
integer variable for the ordinal to save some cycles.

As an old C programmer, I tend to avoid anything that works with Object.
However, on reflection, I couldn't say for sure which was more efficient at
run-time. I would think that Conversion functions have higher overhead, but
I have no proof.
Kevin Spencer
Microsoft MVP
.Net Developer
Neither a follower nor a lender be.


Would I be correct in saying the ordinal is faster though? I tend to
use ordinals in comination with some column name constants.

I

--
Iain Norman | http://www.eliteforum.org
Nov 19 '05 #7
I would think that if you use a typed method such as GetString() with a
literal or variable Ordinal, it would be faster. Again, I have no proof. But
there is no conversion involved, so I would tend to think it was faster.
What I was doubtful about was whether using a typed method with the
GetOrdinal() method would be faster, as in:

objMailMessage.To =
dtrRecipient.GetString(dtrRecipient.GetOrdinal("Em ail"));

This requires 2 method calls for each column.

Still, the GetOrdinal() method just loops through the columns to find one
with the name specified, so it can't be too expensive. I just can't say with
any authority whether the 2 method calls to get the typed value are more
efficient than the 2 method calls using Convert (1 call to the Item()
method, plus 1 call to Convert). My guts tell me that the first alternative
would be faster, since Conversion functions have to use Reflection to derive
the type of the object.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

"Iain Norman" <an******@me.com> wrote in message
news:ln********************************@4ax.com...
On Tue, 22 Feb 2005 09:03:44 -0500, "Kevin Spencer"
<ke***@DIESPAMMERSDIEtakempis.com> wrote:
Doesn't .GetString() require an ordinal position, which, in my opinion
wouldn't make it a "better" choice, just an alternative one with its own
pros and cons


Well, Karl, I'm sure that's debateable. Yes, it does require an Ordinal
position, and I generally use it with GetOrdinal(), as in:

objMailMessage.To =
dtrRecipient.GetString(dtrRecipient.GetOrdinal(" Email"));

If you're going to use the same column more than once, you can set an
integer variable for the ordinal to save some cycles.

As an old C programmer, I tend to avoid anything that works with Object.
However, on reflection, I couldn't say for sure which was more efficient
at
run-time. I would think that Conversion functions have higher overhead,
but
I have no proof.
Kevin Spencer
Microsoft MVP
.Net Developer
Neither a follower nor a lender be.


Would I be correct in saying the ordinal is faster though? I tend to
use ordinals in comination with some column name constants.

I

--
Iain Norman | http://www.eliteforum.org

Nov 19 '05 #8
I have seen test about this, and GetXXX is faster when looping through
records but slower when doing a single record. Can't find the link though
:(

The point I was trying to make is that the performance difference is
incredibly small in both cases for most typical usage (I mean, if ur looping
through 1000 records, then it might start to be a factor, and this probably
isn't at all uncomon, but I still wouldn't call it "typical"). I believe,
with such a small difference, the rule should be maintainability, the
exception performance.

GetXXX(y) by itself, in my opinion, is pretty bad for maintenance. (a) you
don't know what field it's actually getting, (b) it can easily break.
using GetXXX with GetOrdinal however is pretty much are maintainable as the
explicit column names, so the performance benefits are probably key... In
the initial post Kevin didn't make mention of GetOrdinal which I guess is
why I though it necessary to raise a flag (besides, I've never been invovled
in one of Kevin's long threads and thought this could be my chance!)

Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:OZ**************@TK2MSFTNGP14.phx.gbl...
I would think that if you use a typed method such as GetString() with a
literal or variable Ordinal, it would be faster. Again, I have no proof. But there is no conversion involved, so I would tend to think it was faster.
What I was doubtful about was whether using a typed method with the
GetOrdinal() method would be faster, as in:

objMailMessage.To =
dtrRecipient.GetString(dtrRecipient.GetOrdinal("Em ail"));

This requires 2 method calls for each column.

Still, the GetOrdinal() method just loops through the columns to find one
with the name specified, so it can't be too expensive. I just can't say with any authority whether the 2 method calls to get the typed value are more
efficient than the 2 method calls using Convert (1 call to the Item()
method, plus 1 call to Convert). My guts tell me that the first alternative would be faster, since Conversion functions have to use Reflection to derive the type of the object.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Neither a follower nor a lender be.

"Iain Norman" <an******@me.com> wrote in message
news:ln********************************@4ax.com...
On Tue, 22 Feb 2005 09:03:44 -0500, "Kevin Spencer"
<ke***@DIESPAMMERSDIEtakempis.com> wrote:
Doesn't .GetString() require an ordinal position, which, in my opinion
wouldn't make it a "better" choice, just an alternative one with its own pros and cons

Well, Karl, I'm sure that's debateable. Yes, it does require an Ordinal
position, and I generally use it with GetOrdinal(), as in:

objMailMessage.To =
dtrRecipient.GetString(dtrRecipient.GetOrdinal(" Email"));

If you're going to use the same column more than once, you can set an
integer variable for the ordinal to save some cycles.

As an old C programmer, I tend to avoid anything that works with Object.
However, on reflection, I couldn't say for sure which was more efficient
at
run-time. I would think that Conversion functions have higher overhead,
but
I have no proof.
Kevin Spencer
Microsoft MVP
.Net Developer
Neither a follower nor a lender be.


Would I be correct in saying the ordinal is faster though? I tend to
use ordinals in comination with some column name constants.

I

--
Iain Norman | http://www.eliteforum.org


Nov 19 '05 #9
Karl,

Your logic is impeccable. :)

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

"Karl Seguin" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:ul****************@TK2MSFTNGP14.phx.gbl...
I have seen test about this, and GetXXX is faster when looping through
records but slower when doing a single record. Can't find the link though
:(

The point I was trying to make is that the performance difference is
incredibly small in both cases for most typical usage (I mean, if ur
looping
through 1000 records, then it might start to be a factor, and this
probably
isn't at all uncomon, but I still wouldn't call it "typical"). I believe,
with such a small difference, the rule should be maintainability, the
exception performance.

GetXXX(y) by itself, in my opinion, is pretty bad for maintenance. (a)
you
don't know what field it's actually getting, (b) it can easily break.
using GetXXX with GetOrdinal however is pretty much are maintainable as
the
explicit column names, so the performance benefits are probably key... In
the initial post Kevin didn't make mention of GetOrdinal which I guess is
why I though it necessary to raise a flag (besides, I've never been
invovled
in one of Kevin's long threads and thought this could be my chance!)

Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:OZ**************@TK2MSFTNGP14.phx.gbl...
I would think that if you use a typed method such as GetString() with a
literal or variable Ordinal, it would be faster. Again, I have no proof.

But
there is no conversion involved, so I would tend to think it was faster.
What I was doubtful about was whether using a typed method with the
GetOrdinal() method would be faster, as in:

objMailMessage.To =
dtrRecipient.GetString(dtrRecipient.GetOrdinal("Em ail"));

This requires 2 method calls for each column.

Still, the GetOrdinal() method just loops through the columns to find one
with the name specified, so it can't be too expensive. I just can't say

with
any authority whether the 2 method calls to get the typed value are more
efficient than the 2 method calls using Convert (1 call to the Item()
method, plus 1 call to Convert). My guts tell me that the first

alternative
would be faster, since Conversion functions have to use Reflection to

derive
the type of the object.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
Neither a follower nor a lender be.

"Iain Norman" <an******@me.com> wrote in message
news:ln********************************@4ax.com...
> On Tue, 22 Feb 2005 09:03:44 -0500, "Kevin Spencer"
> <ke***@DIESPAMMERSDIEtakempis.com> wrote:
>
>>> Doesn't .GetString() require an ordinal position, which, in my
>>> opinion
>>> wouldn't make it a "better" choice, just an alternative one with its own >>> pros and cons
>>
>>Well, Karl, I'm sure that's debateable. Yes, it does require an Ordinal
>>position, and I generally use it with GetOrdinal(), as in:
>>
>>objMailMessage.To =
>>dtrRecipient.GetString(dtrRecipient.GetOrdinal(" Email"));
>>
>>If you're going to use the same column more than once, you can set an
>>integer variable for the ordinal to save some cycles.
>>
>>As an old C programmer, I tend to avoid anything that works with
>>Object.
>>However, on reflection, I couldn't say for sure which was more
>>efficient
>>at
>>run-time. I would think that Conversion functions have higher overhead,
>>but
>>I have no proof.
>>
>>
>>Kevin Spencer
>>Microsoft MVP
>>.Net Developer
>>Neither a follower nor a lender be.
>>
>
> Would I be correct in saying the ordinal is faster though? I tend to
> use ordinals in comination with some column name constants.
>
> I
>
> --
> Iain Norman | http://www.eliteforum.org



Nov 19 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Anita C | last post by:
I have the foll. code to update the value of an attribute: xmlDocument.Load("abc.xml"); XmlAttribute xmlAttrib = xmlDocument.SelectSingleNode(root/web/theme/@desc); xmlAttrib.Value =...
1
by: Svyatoslav | last post by:
Hi, I have a problem with XmlNodes and my stack. It looks something like this: //declarations XmlNode node, new_node; Stack MyStack = new Stack(); //code MyStack.Push(node);
22
by: Christoph Boget | last post by:
I am getting an error (a few among many) for the following lines of code: retval.BrokerName = (( curRow == System.DBNull.Value ) ? SqlString.Null : (string)curRow ); retval.BrokerGroupId = ((...
6
by: juli | last post by:
I declared: public delegate void PaintEventHandler(object objSender,PaintEventArgs pea); and this.Paint+=new PaintEventHandler(MyPaintHandler); and the: static void MyPaintHandler(object...
2
by: Jeff | last post by:
I get the following error: Cannot implicitly convert type 'Factory.Stack.pArrayStack' to 'Factory.Stack.StackDefs.ImStack' at compile time. I thought perhaps there was a mismatch between the...
2
by: Patrick Olurotimi Ige | last post by:
When i convert:- this code from VB to C# Why do i get error "Cannot implicitly convert type 'object' to 'bool' VB --- If cmdcommand.Parameters("ReturnValue").Value = 1 Then lblStatus.Text =...
3
by: Patrick Olurotimi Ige | last post by:
compiling the code below i get the error:- Cannot implicitly convert type 'object'to 'System.Xml.XmlDocument' I'm getting the error on this line:- myXml.Document =...
7
by: groups | last post by:
This is my first foray into writing a generic method and maybe I've bitten off more than I can chew. My intent is to have a generic method that accepts a value name and that value will be...
1
by: alex21 | last post by:
Ok i am trying to use a Linq query to access a dictionary. public static Dictionary<string, Client> Clients = new Dictionary<string, Client>();Using this Linq query: IEnumerable<Staff> loginquery...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
How does React native implement an English player?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.