|
Hey, seems to have worked! I tweaked it a bit, in case Object isn't the base-base class. As this is a framework, you never know
foreach(Type t in asm.GetTypes())
{
Type baseType = t.BaseType;
bool Complete = false;
while(!Complete)
{
if (baseType == typeof(BasePlugin))
{
if( !t.IsInterface && !t.IsAbstract)
{
FoundPlugins.Add(t);
Complete = true;
break;
}
}
else if (baseType == typeof(System.Object))
Complete = true;
else
baseType = baseType.BaseType;
}
}
|
|
|
|
|
Hi Guys and Gals,
I have my c# win form app connected up to a sql compact db.
I have a form which contains fields to enter company data, ie an address.
Now at the moment when I open that form, I do a read to see if a record exists...
xDataSourceAccess = AppSet.DataSourceAccess;
conn = new SqlCeConnection(Properties.Settings.Default.CS_Account + xDataSourceAccess);
string strRecordExisit = "SELECT OID from tbl_CompanyDetails";
conn.Open();
cmd = new SqlCeCommand(strRecordExisit,conn);
Reader = cmd.ExecuteReader();
if (Reader.Read())
xRecordFound = true;
Reader.Close();
etc....
Is this the the best way to check to see if a record exists? (ie best performance and memory usage)
thanks
|
|
|
|
|
Yep, pretty much. Any other methods you use are going to boil down to the same technique. Though, I'd probably have a stored procedure that checks for the existance and passes back a True/False, or a record count if there is more than one record your checking for in the same table.
|
|
|
|
|
IIRC you can't use stored procedures in SQL Compact.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Hmmm...didn't know that. I've never used it before, having gone only as low as Express. Just goes to show you what "assume" really stands for!
|
|
|
|
|
Hi,
I am developing an application in a Pocket PC using .NET Compact Framework 3.5 with C#..
Can anyone tell me what are the toolkit i need to install to run my application in Pocket PC to convert my voice based commands into text..?
And also let me know what are the classes and libraries i need to use to do the above..
Thanks in advance..
|
|
|
|
|
Hi,
I'm trying to switch between two different tables using the same datagrid using two table adapters and one binding source bndSrc
private void button1_Click(object sender, EventArgs e)
{
bndSrc.DataMember = "Table1";
FirstTableAdapter.Fill(this.dataSet1.Table1);
}
private void button2_Click(object sender, EventArgs e)
{
bndSrc.DataMember = "Table2";
SecondTableAdapter.Fill(this.dataSet1.Table2);
}
Considering the binding navigator number of rows, I can see it's working fine except the datagrid is not being refreshed and it's still showing columns from the previous table and when clearing the datagrid's columns before loading, I just get an empty datagrid with a dull gray background and no columns!! still the binding navigator shows the exact number of rows from the bound table
Please help guys
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
Ok, I just found a solution but it makes the contents disappear!
MyDataGridView.Columns.Clear();
foreach (DataColumn dc in dataSet1.Table1.Columns)
MyDataGridView.Columns.Add(dc.ColumnName, dc.Caption);
And the correct solution is simply to turn on a stupid property that is not even listed in the IDE nor it is set to true by default
MyDataGridView.AutoGenerateColumns = true;
Cheers!
|
|
|
|
|
Did this not work?
MyDataGridView.Refresh();
rafone
Statistics are like bikini's...
What they reveal is astonishing ...
But what they hide is vital ...
|
|
|
|
|
Hell no so make sure you memorize how I eventually solved it
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
I have a class that is full of Bitmap objects and some events. In the application, every instance of a form is using that class with same data. So I thought to make it static that will be filled once then many form instances will use only one. Bitmap objects can be static and I have no problem with that but I'm little confuse about events, I can make static events but is it good choice ? or any other better way ?
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Personally, I would consider using a singleton[^] for this.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
Hi,
it seems to me you want instances of your class, one for each user; assuming your bitmaps are not going to be modified, these instances could share the bitmaps by keeping them in static fields inside your class. The events could be simply instance (i.e. non-static) members (unless they
strongly relate to the static bitmaps of course).
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
modified on Saturday, February 7, 2009 10:57 AM
modified on Friday, June 10, 2011 11:28 PM
|
|
|
|
|
(sorry I ask again, not resolved for a week before.)
Hello everyone,
Here is my code at both client side and server side. My code is simple, just upload a file to an ASP.Net web site.
My client code throws exception when it works on Vista (x64, Enterprise, SP1), but works fine on Windows Server 2003.
Any ideas?
10.10.12.162 is my server address.
Client:
static void Main(string[] args)
{
Console.Write("\nPlease enter the URI to post data to : ");
String uriString = Console.ReadLine();
WebClient myWebClient = new WebClient();
Console.WriteLine("\nPlease enter the fully qualified path of the file to be uploaded to the URI");
string fileName = Console.ReadLine();
Console.WriteLine("Uploading {0} to {1} ...", fileName, uriString);
DateTime begin = DateTime.Now;
byte[] responseArray = null;
try
{
responseArray = myWebClient.UploadFile(uriString, fileName);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.WriteLine(ex.ToString());
}
DateTime end = DateTime.Now;
Console.WriteLine("Elapsed time is: {0}", (end - begin).TotalMilliseconds);
}
Server:
public partial class FileUploadHandler : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
foreach (string f in Request.Files.AllKeys)
{
HttpPostedFile file = Request.Files[f];
file.SaveAs("D:\\UploadFile\\UploadedFiles\\" + file.FileName);
}
}
}
Exception from client side:
Unable to connect to the remote server
System.Net.WebException: Unable to connect to the remote server ---> System.Net.
Sockets.SocketException: No connection could be made because the target machine
actively refused it 10.10.12.162:1031
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddre
ss socketAddress)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Sock
et s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state,
IAsyncResult asyncResult, Int32 timeout, Exception& exception)
--- End of inner exception stack trace ---
at System.Net.WebClient.UploadFile(Uri address, String method, String fileNam
e)
at FileUploadClient.Program.Main(String[] args) in D:\UploadFile\FileUploadClient\Program.cs:line 30
regards,
George
|
|
|
|
|
The stack trace doesn't match the code you've posted - look at the overload of UploadFile .
Anyway, one suggestion: are you putting http:// in the uriString ?
WebClient can use different protocols and may be getting confused. The stack trace shows a failed connection to port 1031 which is being blocked by the firewall on your server.
Nick
----------------------------------
Be excellent to each other
|
|
|
|
|
Thanks Nick,
I have tried adding http:// is not working. I have posted my stack error and my code again. Hope it matches.
Any ideas what is wrong?
class Program
{
static void Main(string[] args)
{
Console.Write("\nPlease enter the URI to post data to : ");
String uriString = Console.ReadLine();
WebClient myWebClient = new WebClient();
Console.WriteLine("\nPlease enter the fully qualified path of the file to be uploaded to the URI");
string fileName = Console.ReadLine();
Console.WriteLine("Uploading {0} to {1} ...", fileName, uriString);
DateTime begin = DateTime.Now;
byte[] responseArray = null;
try
{
responseArray = myWebClient.UploadFile(uriString, fileName);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.WriteLine(ex.ToString());
}
DateTime end = DateTime.Now;
Console.WriteLine("Elapsed time is: {0}", (end - begin).TotalMilliseconds);
}
}
Unable to connect to the remote server
System.Net.WebException: Unable to connect to the remote server ---> System.Net.
Sockets.SocketException: No connection could be made because the target machine
actively refused it 10.10.12.162:1031
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddre
ss socketAddress)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Sock
et s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state,
IAsyncResult asyncResult, Int32 timeout, Exception& exception)
--- End of inner exception stack trace ---
at System.Net.WebClient.UploadFile(Uri address, String method, String fileNam
e)
at FileUploadClient.Program.Main(String[] args) in C:\software\UploadFile\Net
work_Monitor_Demo\FileUploadClient\Program.cs:line 27
Elapsed time is: 4579
regards,
George
|
|
|
|
|
The stack trace is still a bit off - are you using a Release build? You could try a Debug build to help track this down.
I don't understand why WebClient is trying to connect on port 1031. It should be using an HTTP POST on port 80.
Could you catch the WebException explicitly and print the Status code?
Also, 4.5 seconds is a long time accross a LAN. How big is the file you are sending? IIS has a limit of 4MB, but you can set this using MaxRequestLength[^] in your web.config:
<system.web>
<httpRuntime maxRequestLength="10240" />
If none of that works, you could try using UploadFileAsync and hooking the UploadProgressChanged event to see if anything is being sent.
Nick
----------------------------------
Be excellent to each other
|
|
|
|
|
Hi Nick!
Thanks for so many good ideas! I have followed your advice and here is my results.
1.
The port 1031 is the Visual Studio's internal web server address port number -- i.e. when I press F5 in Visual Studio 2008 for the ASP.Net project.
I have tried when I publish the ASP.Net project at server side to IIS and using port 80, everything is fine, but when pressing F5 to run in Visual Studio, there is such error. Any ideas?
2.
I have tracked the Status property for the WebException, the value is "ConnectFailure". Any ideas?
3.
The file is very small, about 1k and is a text file.
From my 3 points above, do you have any ideas why it fails to use Visual Studio internal web server and success to use IIS?
regards,
George
|
|
|
|
|
So, you've been entering "http://10.10.12.162:1031" for uriString ???
This will be blocked by the firewall on the machine running VS. This means that if you run the client on the same machine, it will work because you're not crossing the firewall. If you run the client on a different machine, it will try to go through the firewall on port 1031 and ( quite rightly ) be blocked => ConnectFailure.
It works on IIS using port 80 because this port is open on that machine's firewall - port 80 is the well known port for HTTP.
Your code is fine - it's a network admin problem.
Nick
----------------------------------
Be excellent to each other
|
|
|
|
|
And see File Uploading in ASP.NET Using C#[^] for more info.
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
HI ,
i have a web service installed in IIS of my server machine and in client system i have a C# windows application.This application has a refernce added of the service(dll has been added).This dll take the database connection from mentioned from app.config but i want it read the connection details from web.config of service.
Can you please help me out how can acheive this.
when i try system.web.configriatin.... it refer to client machine.I want it to refer the web.config of the service.
|
|
|
|
|
Hi,
This is from chandrakanth.This is regarding
" How to convert tiff file to text file using tesseract.ocr in C#(Asp.net)" .
Can any one tell me how to do tha asap.
Thanks and Regards
Gaddam.Chandrakanth
|
|
|
|
|
Hi there!
I am building a win application, and I am stucked at one point and I will appreciate your help, if we can solve this issue together. I have a combobox with more values in it. Depending on the person who is selected from listbox, the value in the combobox is different. I am taking that value from DB and I am holding in a string. I want when someone will select an item from the form, the combobox selected item be the value from the string. I already populate the items in the combobox, I just want to know how to make one of the items to be selected when the person will be selected from the list box. Any kind oh help will be appreciated. Thanks in advance, Laziale
|
|
|
|
|
hey hi,
i think u can change the combox selected value changed on list box selected item event.
|
|
|
|
|
combobox.SelectedItem = "item";
or
combobox.SelectedIndex = 0; // any item on 0th index
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|