|
Like Luis said, pinvoke is a better option if you are going to use only a few functions from the DLL and you know the DLLs you are going to use, at compile time. It's very easy to do, just declare a static extern method with the equivalent C# signature of the DLL functions, mark it with the DllImport attribute, and you are done.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Hi
I have some records say 1000 Nos fetched from SQL and stored in a Dataset.
Now I need to fetch and store top 1-50 records in another dataset and top 51-100 records in another dtaset and so on.
Could any one help me how to transfer records from one Dataset to another dataset?
Regards
San
|
|
|
|
|
Surely what you want is a stored procedure that pages your data ? The way to do this is to do two selects, that are nested, use the TOP statement in both, and have one ordered ASC and the other DESC. So the first grabs from the first record through to the last one you want, the other inverts the order and selects from the last one you want to the first one you want.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Sorry My idea is to manipulate the data locally, .
My ultimate aim is to do paging in dataGrid since winform GataGrid is not supporting the Paging.
|
|
|
|
|
Really ? Only the web DataGrid does paging ? I didn't realise that.
Well, the easiest thing would still be a stored proc that takes a page number and size, but if you want to limit your database access, then I guess you'd store the full table locally, and build a datasource from it that you bind to the grid, selecting only the current page rows.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I would add a DataColumn with AutoIncrement set to true to the table, and then use a DataView and its RowFilter property to just return the records with that column from 1 to 50.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
hi all,
My Question is like this:
Our network is workgroup.Then How do we Logg on to NETWORK Computer using C#?.
I need to handle a service in other computer ..but it says that "You haven't enough previleges to access this Service Control"
So I need to hardcode user name and password of that machine.So what is the method or way to logg on to NETWORK computer..?
But our NETWORK is a WORKGROUP not a Domain.
I know there is way to logg on to other computer if our computers are in a DOMAIN..
So please any one tell me how to access workgroup computer using C#?
thanks in advance.
|
|
|
|
|
I run a workgroup at home, and in my experience, you need to either add a $ to the drive name you use in your path ( which gets you in as admin ), i.e. \\myPC\c$\My Documents\etc., or you need to set up the permissions you require on the machine you're connecting to.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thank you very much!
program jys 2003 77 60 kill Japan.
|
|
|
|
|
Do you mean the IP of the host computer (the one the app is running on?) In a Windows Forms app use this code:
string strHostName = "";
string strIP;
try
{
strHostName = Dns.GetHostName();
IPAddress [] ips = Dns.Resolve(strHostName).AddressList;
if(ips.Length >= 1)
strIP = ips[0].ToString();
else
strIP = "(error)";
}
catch
{
if(strHostName == null || strHostName.Length == 0)
strHostName = "(error)";
strIP = "(error)";
} If you are developing an ASP.NET application and you want to get the IP of the computer connecting to you, I suppose it's possible, but I have no idea.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
I means to How do I find the IP address of the Client App connecting to a dot NET remoting service(C#).
program jys 2003 77 60 kill Japan.
|
|
|
|
|
Well, then I have no idea.
This is why you should explain your question the best you can the first time. "How to get client IP" is just to vague. There are many situations where that phrase makes sense and there's no way for us to know which in particular is your situation. By asking better questions, you can be sure of getting better answers that really address your problem, and not, like in this case, an answer that took some time to write that is totally unrelated.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
i want some information about all port
|
|
|
|
|
I live in Hobart. Hobart is a port, but not a busy one. Melbourne is a busier port, but Sydney is busier again.
If you wanted other information, be a little more specific about what you're trying to do.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Maybe he meant something like this.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
The really sad part is this is the second time he's posted this very same statement! He deleted the first one after getting a similar response.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
I have a big array n*n matrix in an .xls (Excel Spreadsheet) and I want to read it into the my C# which calculates the inverse of it. I am not sure how to read the xls file into a 2D array.
n is variable, i.e. it is not known beforehand. It can be 300, 400 0r 500 or any value. Basically, the user gives the input as the file name in which he has storted the matrix.
And does anyone aware of any fast and qucik algorithm by which I can check if a large matrix is singular or not.
Regards
|
|
|
|
|
Hey folks,
I am not very good at C# programming.
I want to write a piece of C# code to change the Pool size in Application pooling of a COM+ component?
Do you guys know how can I do that.
Thanks a bunch.
Tommy.
|
|
|
|
|
Hi! Im creating a form in which i retrieve data from a database and attach it to a grid. I need to have a function in which if i click the save button the results of the retrieved data will be saved as a "text" file. cane someone please tell me what's wrong with my code bcoz whenever i click my save button it doesn't save at all. here's my code:
private void btnSave_Click(object sender, System.EventArgs e)
{
OdbcConnection cnn = new OdbcConnection();
cnn.Open();
OdbcCommand cmmd = new OdbcCommand();
OdbcDataAdapter adp = new OdbcDataAdapter (cmmd);
DataSet ds_emp = new DataSet();
adp.Fill(ds_emp);
System.Text.StringBuilder sb = new System.Text.StringBuilder();
for(int i=0;i<=ds_emp.Rows.Count - 1; i++)
{
for(int q=0;q<=ds_emp.Columns.Count - 1; q++)
{
sb.Append(ds_emp.Rows[i][q].ToString());
}
sb.Append(" ");
}
Response.Clear();
Response.AddHeader("content-disposition", "attachment;filename=*.txt");
Response.Charset = "";
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = "application/vnd.text";
System.IO.StringWriter strWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new System.Web.UI.HtmlTextWriter(strWrite);
Response.Write(sb.ToString());
}
where ds_emp is the retrived data. Is there something wrong with my code? It builds but it doesn't work. Thanx for all your replies! I appreciate it
thanx
|
|
|
|
|
I have the following URL:
http://patft.uspto.gov/netacgi/nph-Parser?Sect1=PTO2&Sect2=HITOFF&u=/netahtml/search-adv.htm&r=2&p=1&f=G&l=50&d=ptxt&S1=((teeth+OR+member)+OR+provide)&OS=+(teeth+OR+member)+OR+provide&RS=((teeth+OR+member)+OR+provide)
Accessing it with the following code snippet (which works for other sites):
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
throws a WebException (timeout). Accessing the same URL with IE works fine. I compared the request header sent by the code and the one sent by IE and they are identical. The user agent has been set to "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50215)"
I even increased the request timeout to a massively huge value and it didn't make any difference.
|
|
|
|
|
There is something wrong with the headers. I was getting this error: "The underlying connection was closed: The server committed an HTTP protocol violation." put this in your config file and it should resolve the issue.
<configuration>
<system.net>
<settings>
<httpwebrequest useunsafeheaderparsing="true">
|
|
|
|
|
Put what? It looks like you forgot to check the box below the message window that says "Do not treat <<s as HTML tags".
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Sorry dude. Here it is:
<configuration>
<system.net>
<settings>
<httpWebRequest useUnsafeHeaderParsing="true" />
</settings>
</system.net>
</configuration>
|
|
|
|
|
You might want to reply to the original poster with this, not me. He'll get a notification e-mail that says you replied to him that way.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Is it possible to insert a jpg,gif or a bitmap file into a crystal report programmatically? If so can someone point me in the right direction. I've been looking on the web but can't seem to find anything about it.
|
|
|
|