|
Hi all,
I have HTML code like: "". how can I get the final local path that this web handler generated or other methods to get a reference to the final image?
Thanks,
|
|
|
|
|
You can't find out the path on the server. If you're running this code on your server, then you should be in the ASP.NET forum.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
I want to save ,or print The Whole ClientZone Of Window With The Scroll .when I used the API function - bitblt- to save,or print ,but it only save ,or print the part that is showed in the screen ,not the whole Clientzone.
so ,now ,I pleg help from someone who knows how to do it,
thank you .
|
|
|
|
|
Dear All,
I had the following code tested in my test environment, it works fine in my test environment
private bool CheckRcvFileLocation(string rcvLocation, ForeignSystem foreignSystem)
{
Uri uri1 = new Uri(rcvLocation);
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(uri1);
request.Credentials = foreignSystem.NetworkCredential;
request.Method = "HEAD";
HttpWebResponse response = null;
try
{
System.Console.WriteLine("test2");
if (request == null)
{
System.Console.WriteLine("Test2a");
}
else
{
System.Console.WriteLine("Test2b");
}
response = (HttpWebResponse)request.GetResponse();
System.Console.WriteLine("Test3");
return (response.StatusCode != HttpStatusCode.NotFound);
}
catch (WebException e)
{
response = (HttpWebResponse)e.Response;
if (response.StatusCode == HttpStatusCode.NotFound)
return false;
else
throw;
}
finally
{
if (response != null)
response.Close();
}
}
however when I put it into the real world, the "Test3" never gets executed, instead it returns me "Object reference not set to an instance of an object" as soon as the code goes to "response = (HttpWebResponse)request.GetResponse();"
Are there any settings that i need to aware to get these codes working in production environment?
regards
Andie
|
|
|
|
|
Any news when LINQ be able to talk to Oracle/MySQL/Sybase ...? I hear thus far it's very much a M$ specific...
(And what do you think it will do to NHibernate when it starts supporting other db?)
Thanks
dev
|
|
|
|
|
Hi everyone. I'm new here and new to using C# coding as well so any help would be greatly apprectiated! I am trying to build my program but this message keeps popping up: Operator '||' cannot be applied to operands of type 'bool' and 'string'
I have tried everything that I know. Please help! The code is below:
using System;
namespace Program13
{
class StateAbbreviations
{
public static void Main( )
{
string stateabb;
Console.WriteLine("Enter all of the following state abbreviations: NC, AL, GA, FL, OH");
stateabb = Console.ReadLine();
Console.WriteLine("\n");
if (stateabb == "NC" || "nc")
Console.WriteLine("North Carolina");
else if (stateabb == "AL" || "al")
Console.WriteLine("Alabama");
else if (stateabb == "GA" || "ga")
Console.WriteLine("Georgia");
else if (stateabb == "FL" || "fl")
Console.WriteLine("Florida");
else if (stateabb == "OH" || "oh")
Console.WriteLine("Ohio");
else Console.WriteLine("Not one of the selected states");
}
}
}
|
|
|
|
|
Hi,
try if (stateabb == "NC" || stateabb == "nc")
I advise you buy and study a tutorial book on C#, any book will do you good.
|
|
|
|
|
Oh my gosh! Thank you so much. Worked like a charm. I forgot about that haha.
|
|
|
|
|
Why don't you actually read the error message and check against your code?
it said "Operator '||' cannot be applied to operands of type 'bool' and 'string'" which is what you had, an || operator in between a bool and a string.
|
|
|
|
|
I know. Like I said, I am very VERY new to this so I am getting used to all these new terms. I am kinda getting the hang of it though.
|
|
|
|
|
So 'Nc ' isn't a valid entry, is it (of course doesn't make sense discriminating such a bad way 'Carolina'...)?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
May I suggest you use a HashSet?
System.Collections.Generic.HashSet<string> StateAbbs =
new System.Collections.Generic.HashSet<string>() ;
StateAbbs.Add ( "NC" ) ;
...
if ( StateAbbs.Contains ( stateabb ) ) ...
Or something like that, perhaps with a case-insensitive comparer.
|
|
|
|
|
Hi everyBody,
I need the code for sending SMS from PC while the mobile set is connected to PC through USB port.
I have found the code for Com port, but I need the code for USB port.
Thanks for your help.
My ID: invisible_eagle@yahoo.com
|
|
|
|
|
Yep...and i need the code to be rich. Anyone interested to share it for free and let me live as a happy and lazy parasite ?
|
|
|
|
|
I am having a strange issue with reading from Excel with C#
Here is my code:
string excelConnectionString = string.Format("Provider=Microsoft.Jet.OLEDB.4.0; data source={0}; Extended Properties=Excel 8.0;", txtExcel.Text);
OleDbConnection con = new OleDbConnection(excelConnectionString);
con.Open();
OleDbDataAdapter da = new OleDbDataAdapter("select * from ["+ txtFY.Text +"$]", con);
fy.Text = txtFY.Text;
DataTable dt = new DataTable();
da.Fill(dt);
con.Close();
dataGridView1.DataSource = dt;
dataGridView1.Refresh();
Now it works.. its just some columns that have information in the "actual" excel sheet doesn't appear in the data grid view..
Example:
Here is a column (Serial Column):
136WFW7552
136WFW7556
136WFW7494
136WFW7553
136WFW7492
70101135
71000640
70202250
70101234
70101230
Now when the numbers go from 136WFW7492 to 70101135, it doesn't put the 70101135 numbers in the datagridview... I've removed formatting from the workboot and everything.. I'm confused
|
|
|
|
|
What data/columns are in the raw DataTable? Is it what is to be expected?
Try putting HDR=Yes; in your connections string. I can't remember off-hand what the default is.
Edit:
This article pretty much sums it up. Reading and Writing Excel using OLEDB[^]
hmmm pie
modified on Friday, April 24, 2009 5:18 AM
|
|
|
|
|
I've tried that document and it doesn't seem to work.. Any other ideas?
|
|
|
|
|
There's always the alternative way of Opening the file itself. Have a look at this example[^]
Also have a look at this: Opening and Navigating Excel with C#[^]
It's not ideal but it's a work around.
My failometer is detecting vast quantities of FAIL!
|
|
|
|
|
Im not sure if it will work or not but you may be able to select the columns using GetOleDbSchemaTable().
Then use those columns in the select query,
private string[] _GetColumnsFromWorkseet(string sheetname, out string errorMessage)
{
try
{
List<string> ls = new List<string>();
DataTable dtCols = _oleDbConn.GetOleDbSchemaTable(OleDbSchemaGuid.Columns,
new Object[] { null, null, sheetname, null });
foreach (DataRow dr in dtCols.Select(string.Empty, "ORDINAL_POSITION"))
ls.Add(dr["COLUMN_NAME"].ToString());
errorMessage = string.Empty;
return ls.ToArray();
}
catch (Exception ex)
{
errorMessage = ex.Message;
return null;
}
}
My failometer is detecting vast quantities of FAIL!
modified on Friday, April 24, 2009 10:20 PM
|
|
|
|
|
I actually got it to work on that article. I changed the reg key, turned HDR to YES, but what I had to do was put in IMEX=1 which I don't think was in that document.
|
|
|
|
|
Its aknown problem using oledb to read from Excel. It decides the column data type from the first (I think) 8 rows, and any subsequent data that does not match the data type is ignored.
I can see the sense if the column looks like a number and later you get text, but not the other way round. Anyway, thats how it works. It has caught me out before.
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
I tried modifying from that article and it doesn't work.. any other ideas?
|
|
|
|
|
I just opened excel from within my app, saved the data as csv and rea dit from there.
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
hui guyz i am working on an ftp client which is working quite properly but have an issue it only uploads and downloads files one by one, so plz help.
|
|
|
|
|
The answer is obvious - you need to select multiple files and upload them in a loop. You can't FTP more than one file at once.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|