Jump to content
Xtreme .Net Talk

DiscoJimmy

Members
  • Posts

    8
  • Joined

  • Last visited

Everything posted by DiscoJimmy

  1. Should be pretty straightforward if we're talking regular .NET and not Compact, right? How is the info getting into the datagrid? You should have an interface that takes input and populates a DataTable, then bind the DataGrid to the DataTable throught the DataTable.DataSource property. As far as submitting the data, you can just open an OleDbConnection and copy the data to that connection either manually or through an OleDbDataAdapter. Check the MSDN for examples of these controls, they really easy to use.
  2. Hi all, I'm writing an app for PocketPC with .NET CF (C#), and am having some trouble with the data layer. A lot of people seem to have noticed that XML is pretty slow on CF, and so I thought I'd switch to SQL CE. What I was doing wasn't very involved: I need a datagrid bound to a dataset ( 1 Table, 65 fields, 25 - 100 rows). So at first I simply did: DataSet ds = new DatSet(); ds.ReadXml(filename); This takes a REALLY long time, about 20 sec. for 26 rows, (although I got it down to 14 sec. after the CF Service Packs) So I read in a post at .NET 247 that SQL Server CE would be a great deal faster for this sort of thing, but the thing is I'm finding it to actually be SLOWER. Am I doing something wrong? Basically I did this: SqlCeConnection conn = new SqlCeConnection(connStr); conn.Open(); SqlCeCommand cmd = new SqlCeCommand("SELECT * FROM myTable", conn); SqlCeDataReader reader = cmd.ExecuteReader(); //DataRow dr; object[] values = new object[ds.Tables[0].Columns.Count]; while(reader.Read()) { //reader.GetValues(values); values[0] = reader.GetString(0); //ds.Tables[0].Rows.Add(values); } And it actually took LONGER than the ReadXml method. I even noticed that it's pretty slow just using the SQL Query tool installed on my PocketPC. Although I can get better performance out of a page or so of code using the raw XmlTextReader, this is a bit of a pain - I have to format all the column names, read the attributes and set the data types etc. Is there anything I can do to speed this up? Everyone is writing these articles about how great SQL CE is, and I use SQL2000 a lot and it's crazy fast, so I figure I must be doing something wrong. Thanks for any help, Nick
  3. Hi, I'm not sure how to go about this, but I know it's possible. I have an application using a TCP socket to send and receive info on a certain port. Now I want another program to listen to the same port, and read the incoming data, but without disturbing the previous socket. I've seen software called packet sniffers, or port sniffers, that are accomplishing this, but with the .NET socket class you can't bind two sockets to the same port. Anyone have any ideas on how to do this? I think it may have something to do with the IOctl method of the socket, but I have no idea how. DiscoJimmy
  4. You can use UDP instead of TCP. Sorry, I don't actually know much about UDP, except that it is a connectionless protocol. When you use Sockets in .NET, the Socket constructor takes a Protocol enumeration as one of the arguments. Protocol has a few enumerations I think, one is Tcp and one is Udp. Check MSDN for examples. DiscoJimmy
  5. Does anyone know how to get a handle to a .NET Bitmap object in Compact Framework? The GetHBitmap method is obviously missing, and I'm not familiar with API stuff much. I can call SHLoadDIBitmap(filename), and that works for a file, but I need a handle to a Bitmap created on the fly, such as: Bitmap bmp = new Bitmap(200,200); I'm planning on passing this hBitmap to a C++ .DLL and can't find anything that doesn't give me a null hBitmap, or one that points to a black square. Thanks for any help.
  6. well, im not sure about IrDA, but with a regular socket class you can specify the port in the endpoint that the socket listens to, like this: IPHostEntry ipHostInfo = Dns.Resolve(Dns.GetHostName()); IPAddress ipAddress = ipHostInfo.AddressList[0]; IPEndPoint localEndPoint = new IPEndPoint(ipAddress, port); Socket listener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp ); listener.Bind(localEndPoint); listener.Listen(number_of_backlogs); then you can do a listener.Accept() and listener.Recieve(), There's a really good tutorial on sockets in the msdn. Jimmy
  7. ok, assuming I can forward the ports(which i also don't know how to do), what would the code be like? I've always been using things like: IPHostEntry ipHostInfo =Dns.Resolve(etc) IPAddress ipAddress = ipHostInfo.AddressList[0]; remoteEP = new IPEndPoint(ipAddress, 11000); where does my local IP come in? what i mean is, I can only specify 1 IP address with this type of code, and I assume that would be the router's IP. how would I then specify a particular computer on that network? Thanks, DiscoJimmy - oh, and if you could give me a hint on forwarding those ports, that would be cool too - it's a Linksys 4 port Router
  8. Ok, I think this probably a very basic question. I'm a C#/VB.NET programmer who knows very little about network communications. I've managed to hack out a chat application based on Sockets. I made another based on TCPClient/TCPServer classes that ran the same way. The problem is that it only works over my office network. I've been using the local IP's (10.0.0.5 etc.) Is it possible to talk to these ports when you're outside the LAN? If I get the IP address of the network, and I know the local IP, what do I do? The network has no proxy, and is just a couple of computers and a router(or maybe hub). Thanks in advance, DiscoJimmy
×
×
  • Create New...