|
Ennis Ray Lynch, Jr. wrote: UPDATE FROM
Ennis can you elaborate on this. Is it like the select into shortcut for creating tables?
Wondering if I have missed something all these years?
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
UPDATE customer
SET customer.firstName = remoteCustomer.firstName
FROM customer
INNER JOIN remoteCustomer ON
remoteCustomer.id = customer.Id
AND remoteCustomer.GUID <> customer.GUID;
Need custom software developed? I do C# development and consulting all over the United States.
If you don't ask questions the answers won't stand in your way.
Doing a job is like selecting a mule, you can't choose just the front half xor the back half so when you ask me to do a job don't expect me to do it half-assed.
|
|
|
|
|
Thanks Ennis
Nothing new there, just thought there might have been something quite different. Sometimes I come across something in the forums completely new in a tool I have been using for ages (eq SQL).
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
hi all
i want to access gmail programatically using c#.
i will just enter my email id & password. if the email id & password is true then the server will give me a response.
but its giving me error the remote server returned an error 403
pls help me
thanks in advance
NameValueCollection nvc = new NameValueCollection();
nvc.Add("accountType", "HOSTED_OR_GOOGLE");
nvc.Add("Email", "dllcheck@gmail.com");
nvc.Add("Passwd", "dllcheck123");
nvc.Add("service", "cl");
nvc.Add("source", "Gulp-CalGulp-1.05");
WebClient client = new WebClient();
byte[] Response = client.UploadValues("http://www.google.com/accounts/ClientLogin",nvc);
string s = Encoding.Default.GetString(Response);
MessageBox.Show(s);
// http://www.google.com/accounts/ClientLogin/accountType=HOSTED_OR_GOOGLE&Email=jondoe@gmail.com&Passwd=north23AZ&service=cl&source=Gulp-CalGulp-1.05
HttpWebRequest webreqAuthenticate = (HttpWebRequest)WebRequest.Create("http://www.google.com/accounts/ClientLogin");
webreqAuthenticate.ContentType = "application/x-www-form-urlencoded";
webreqAuthenticate.Method = "POST";
webreqAuthenticate.ContentLength = 200;
//webreqAuthenticate.Timeout = 6000;
webreqAuthenticate.AllowAutoRedirect = true;
webreqAuthenticate.MaximumAutomaticRedirections = 10;
HttpWebResponse webresAuthenticate = webreqAuthenticate.GetResponse() as HttpWebResponse;
Stream streamResponse = webresAuthenticate.GetResponseStream();
|
|
|
|
|
There are existing solutions for accessing Gmail from C#:
Click[^]
|
|
|
|
|
I am not sure this is the right place for this question but here it is:
Has anyone else had problems with the SqlCeReader.Read() ? Mine doesn't like reading type int from the database and i had to write the query like this (in order to avoid Data conversion failed. [ OLE DB status value (if known) = 2 ]):
SELECT OfficialRegNo, TransponderID FROM BasicAnimal UNION SELECT CAST(FilterObjectType AS nchar), Caption FROM Filter
so, before it was:
SELECT OfficialRegNo, TransponderID FROM BasicAnimal UNION SELECT FilterObjectType, Caption FROM Filter
Anyone knows why?
|
|
|
|
|
You have a data type problem in your database. It would appear that you're trying to put a number is a string field or some other implicit conversion. Did you change a data type somewhere??
|
|
|
|
|
Hi! The datatype in the DB is int and I am only doing a Select query. Only way I could get the Read() method to work was to typecast the int to a nChar. The problem table with an int is FilterObjectType. So I am not trying to insert anything here.
Well, no I haven't changed datatypes anywhere, only this query to the DB.
BTW, I am quering a Sql Server Ce .sdf DB in this case. Not the Express here (was a bit confused when writing prev mess).
This is the only code I have written for this so far is this:
SqlCeConnection conn = new SqlCeConnection();
conn.ConnectionString = "Data Source=todos.sdf;Persist Security Info=False";
SqlCeCommand comm = new SqlCeCommand("SELECT OfficialRegNo, TransponderID FROM BasicAnimal UNION SELECT CAST(FilterObjectType AS nchar), Caption FROM Filter", conn);
conn.Open();
SqlCeDataReader myReader = comm.ExecuteReader();
do
{
Console.WriteLine("\t{0}\t{1}", myReader.GetName(0), myReader.GetName(1));
while (myReader.Read())
Console.WriteLine("\t{0}\t{1}", myReader.GetString(0), myReader.GetString(1));
} while (myReader.NextResult());
myReader.Close();
conn.Close();
|
|
|
|
|
If officialRegNo and filterObjectType are not implicitly convertible you will get this error in all versions of SQL Server.
Need custom software developed? I do C# development and consulting all over the United States.
If you don't ask questions the answers won't stand in your way.
Doing a job is like selecting a mule, you can't choose just the front half xor the back half so when you ask me to do a job don't expect me to do it half-assed.
|
|
|
|
|
Is there a simple way of sorting a BindingList by the given object element?
A code example of the OrderBy function would be very helpful!
Thank you!
|
|
|
|
|
|
I did, it does seem like an overkill since the BindingList has an OrderBy function. I just don't know how yo use it.
|
|
|
|
|
If you want to support sorting, you have to derive your own class from BindingList. This[^] MSDN article explains why you should do that and how. Please read carefully, especially the "BindingList<t>: What's Missing" section.
|
|
|
|
|
riddick_86 wrote: Please read carefully
Well that's an extremely high expectation round here. Reading carefully is also considered overkill by most our members. Magic is preferred, or when not available a copy paste solution will do.
|
|
|
|
|
Thanks I'll check it out!
|
|
|
|
|
riddick_86 wrote: you have to derive your own class from BindingList
Turns out there was a simple way after all.
listOfObjects = listOfObjects.OrderByDescending(c => c.NameAndSurname).ToList();
That was a list, then I just convert it back to a BindingList.
|
|
|
|
|
Is "listOfObjects" a BindingList to begin with? If it is then you can't use this trick to sort the list as ToList() gives a generic list which cannot be converted to a BindingList, or am I missing something?
Rafique Sheikh
"The truth will set you free but first it will piss you off".
|
|
|
|
|
Rafique Sheikh wrote: Is "listOfObjects" a BindingList to begin with? If it is then you can't use this trick to sort the list as ToList() gives a generic list which cannot be converted to a BindingList, or am I missing something?
Took some digging in our SVN to find that code.
"listOfObjects" is a normal List<>, which I sort as explained in my previous post.
I simply convert it back to a BindingList using a foreach loop, adding each object to the new BindingList one-by-one. I think it has a slight speed penalty, but it works great and I had no better workable solution at the time.
|
|
|
|
|
Thanks for the reply. I see, that's what I thought. Actually the OrderByDesceending and OrderBy, both return an IEnumerableOrdered array which you can iterate over to do the same. I was trying to avoid because of the penalty and also for cleaner code. It is too bad that when you call OrderBy on a BindingList or any other such object the actual list is not ordered but rather you are returned an ordered list. I have the same frustration with this as I have with functions like Remove, Replace for strings etc. Why don't they change the object on which we perform those actions?
Anyway, I think I will have to derive from BindingList<t> and write my own SortableBindingList class!!
Rafique Sheikh
"The truth will set you free but first it will piss you off".
|
|
|
|
|
BindingList<MyClass> b = new BindingList<MyClass>();
b = new BindingList(b.OrderBy( m => m.MyPropertyFromMyClass).ToList()));
|
|
|
|
|
|
hello..
i have to send data i mean collection of5 string variables over the tcp connection using a socket. but the problem is that each time i have to ecode the string to byte and send. can i send all the strings as a collection of bytes or array and decode the sequence at the destination i.e the rciever... thans for any advices.... bye
|
|
|
|
|
Yes, you can use the Encoding.GetBytes[^] method for encoding the strings into bytes,
then you can use Encoding.GetString[^] at the destination to decode the bytes into strings.
Edit: Sorry, I misread your post. What you want to do is to collect all strings, convert them into bytes and send them all at the same time - then decode them at the receiver. Let's say you have an array with the strings - use a StringBuilder and a foreach loop to build the strings into one big string. Remember to apply a seperator after each string:
builder.Append(theString + seperator);
The strings would then come out as (assuming semi-colon ( ; ) is the seperator):
hello;goodbye;hi;
At the receiver application you would then split the string (after decoding it of course) into an array to get each string.
I hope you could understand what I tried to say, otherwise ask.
Kristian Sixhoej
"You can always become better." - Tiger Woods
modified on Wednesday, February 18, 2009 10:37 AM
|
|
|
|
|
that was fine i got it... thank you for the keen interest.... have a gud day..
|
|
|
|
|
You're welcome.
Good day to you as well.
Kristian Sixhoej
"You can always become better." - Tiger Woods
|
|
|
|