Transferred from MicrosoftCommunity
Host and expert introduction HOST: guest_fanfan Microsoft expert: Zheng Ziying (guest_eric [MS]), Huang xuebin (guest_steven _ms) Host guest_fanfan says: Welcome to the Microsoft online technology chat. Host guest_fanfan says: Today's chat topic is ADO. net and data management in. net frameworkhost guest_fanfan says: the chat time is PM-5: 00 host guest_fanfan says: First of all, let's welcome the Microsoft expert host guest_fanfan says from Microsoft's Global Technical Center: zheng Ziying host guest_eric [MS] says: Hello, everyone host guest_fanfan says: Huang xuebin host guest_steven _ms says: Hello, everyone! Q: How can I create a dataview for a single table? Cannot I create a dataview for multiple datatables? [A] No. Dataview filters and sorts data tables. You can use the join statement to display the content of multiple tables in a single DataGrid. [Q] javanow: I want to sort the data of a datatable in the descending order. [A] Yes. dataview is generally used for sorting datatable. You can set the sort mode and filter. [Q] What is the efficiency of using dataview if there are tens of thousands of records in a dataset ?? [A] if the data volume is large, for example, tens of thousands, we recommend that you use datareader instead of dataset. Otherwise, the offline data volume is too large, which consumes a lot of memory. [Q] Gentleman: How can I improve the efficiency in dataset when the resulting dataset is large (tens of thousands of records? [A] when using dataset to process tens of thousands of records, try to select a few columns and try not to put text or blob in dataset. [Q] ZB: Can ADO. Net Connect to the Oracle database. [A] Yes. You can use oledbprovider. [Q] yanhao: Use the join statement to display the content of multiple tables in a single DataGrid? How is this actually done? [A] example:
String strsql = "select * from [MERs] inner join [orders] on [Customers]. customerid = [orders]. customerid "; this. dataadaptermaster = new sqldataadapter (strsql, connection); this. dataadaptermaster. fill (this. dataset); datagrid1.datasource = This. dataset;
In this way, multiple tables can be joined to a DataGrid. [Q] Ayou: Now I like ADO. net is connected to the database, because originally I like ado, but with datesets, I feel more important. Of course, the idea of going offline is very good for emancipating the server, but it will bring some trouble to the writers! What do you think! [A] datareader In ADO. Net still adopts the same method as recordset. Dataset adopts completely different new ideas. dataset contains data schema, data content, and data relationships, which are all offline. This reduces the burden on database servers and reduces the number of connections established. [Q] allanyan: How can I create a command for dataadapter as needed? [A] dataadapter can automatically create insertcommand and deletecommand. [Q] javanow: Ds. tables [0]. defaultview. sort = "Sort ASC"; datatable dt = (datatable) ds. tables [0]. defaultview. table; cannot be sorted. [A] After specifying the order of dataview, you need to re-bind the data source. [Q] mmkk: if an application Program It is already in use, but the change needs to overwrite the. dll in the bin. Will the session used by the customer disappear at this time? [A] Yes. After the Assembly is updated, ASP. NET restarts and the session is lost. [Q] yanhao: I used XML data to fill in dataset and then load it into the DataGrid. How can I perform this operation? [A] You can use dataset. readxml to read an XML file and enter the DataGrid. [Q] Ayou: Does datasets need to store all the data in the memory? It's not a waste of memory usage! [A] You do not need to read all the data in the database into dataset. You can select the data you need. [Q] snoic: Can I delete a record on the server directly by using a commandbuild object to delete it in the datatable? [A] Yes. dataset. Update () can be automatically completed. [Q] javanow: I directly use for (INT I = 0; I <DT. rows. count-1; I ++) Does it fail to use sort to traverse each row of the datatable? [A] You 'd better create a dataview based on Mr. able, and then specify the data source of the DataGrid as the dataview. Then you can specify the sorting in dataview. [Q] aqiang: How can I connect to the. DBF data table of FoxPro? Thank you! [A] Write the connection string and then use oledbconnection to connect. [Q] xiaohei: Can I list the conditions for using dataset. [A] It is very convenient to use dataset when multiple data tables exist. [Q] allanyan: What can I do to allow dataadapter to automatically create the corresponding command as needed ???? [A] The table in the database should have a primary key. [Q] Is oledbconnection and sqlconnection provided in Ayou: vs. Net related to ADO. Net? [A] It is related. It is used when ADO. Net establishes a database connection. [Q] cforce: Is it more efficient to directly use XML for databases and access for databases? [A] Access database efficiency is relatively high. After all, access is a relational database. There are already some third-party XML-only databases. You can refer to the following. [Q] snoic: Can the DataGrid set special colors and fonts for a row or column? [A] You need to inherit the datagridtextboxcolumn and reload the paint method based on your own conditions. [Q] blues_song: shows or examples of applications developed by. net. [A] vs. Net comes with a duawish example, which is worth noting. [Q] Ayou: Do I have to set oledbconnection and sqlconnection in the design view of vs. Net? Can I use it only? Code . This is different from connecting to the database by Directly Writing ADO. Net statements! [A] Yes. [Q] letian: How can I obtain the datagird header name for the columns dynamically generated by the DataGrid. [A] we recommend that you use datagridtablestyle to control each column. [Q] allanyan: Do you have any connection between the dataset primary key in dataset and the primary key in the database? [A] Not exactly the same. However, if you want to fill data to dataset or dataset. Update (), the two primary keys must be consistent. [Q] Wuwei: Can a web app written by ASP. NET be distributed to NT4.0 + IIS4. [A] No. [Q] aspx: How long is the dataset lifetime? Does it mean to refill data in the dataset every time the page is post. [A] Yes. dataset will not be saved in the server segment unless the dataset is placed in the session. [Q] china_boy: Can the DataGrid adjust the spacing of each column at will? How can it be adjusted ??? [A] It is recommended that you use datagridtablestyle to control each column. For details, refer to msdn. [Q] janesnow: [Q] Can I save the multi-table data query results to a able (not dataset) and exclude fields with the same name? [A] Yes. You can join and query data from multiple tables in the database and put it in a datatable. [Q] Can jielei: ASP. NET develop DB2 or Oracle 9i? [A] Yes. You can connect to various databases through oledbprovider, provided that these databases support. net. [Q] rivergq: If a connection of ADO is used for a long time, will the problem of memory consumption be solved? [A] In ADO. net, connection should be released after data is queried, so there is no need to worry about increasing server load, because ADO. NET will do connection pool. [Q] javanow: DataGrid sorting control: [a] The following is an example:
dataview DV = new dataview (this. datatable); DV. Sort = "XXX"; DataGrid. datasource = DV;
You can try javanow. [Q] china_boy: I have never been able to convert the content of a simplified database to a traditional display. Do you have any tips for this. [A] traditional Chinese Simplified conversion can be done through programming on the client. For details, see http://www.csdn.net/expert/topic/836/836558.xml. [Q] LDz: ADO. Net? [A] oledbprovider can back on a variety of databases, and can be upgraded based on database server changes, but it can always ensure that the excuses remain unchanged. [Q] FF: how to obtain the relationship between tables and the constraint relationship of fields in dataset. [A] dataset. relations. [Q] lyy: I want to learn more about ASP. NET. Can I recommend some good books? [A] ASP. NET advanced programming [Tsinghua University Press]. [Q] china_boy: Can the DataGrid adjust the spacing of each column at will? How can it be adjusted ??? [A] Yes, but the practices in webform are different from those in winform. [Q] jjmm: whether to use a connection in the application, or create a new connection for each database operation, and close it every time. [A] It is better to create each time. Don't worry that this will cause too many connections or frequent connections, because ADO. NET provides the connection pool. [Q] Seven: I want to learn more about ASP. NET. Can I recommend some good books? [A] You can learn the sample of Microsoft petshop and ibuyspy, which will be of great help to you. [Q] FF: How does dataset pass in COM ??????? [A] Yes. At least dataset can be serializable and can be transferred across processes and machines. [Q] maorachow: How does VC ++. net use ADO to access SQL Server? My practice is to use COM interface cadorecordbinding. What is the best currently? My method cannot add or subtract records? [A], you can use the managed extension in VC ++. Net to leverage ADO. net. [Q] LDz: ask a very important question C # will it be possible to run on a Windows platform in the future? That ADO. Does net work ?? [A] No problem. You only need to run the. NET Framework. [Q] w_z_y: when turning pages, it is a waste of memory to put all the data in the database into dataset and then bind the data to it? Is there any other good solution? [A] If there is too much data, you can create pagination in stored procedure. [Q] dance1969: Is the table in dateset saved to a file? Is there a save method in the recordset of the old ado? Thank you. [A] Yes. [Q] LDz: When ADO. NET is used in a thread, does each thread need to establish a connection and can work with the connection? [A] Yes. You can establish a common connection. [Q] Can you tell me how to paging in stored procedure! [A] pages in SP are irrelevant to ADO. net. Ado. Net is a method for processing data. [Q} icerain: How do other dataset programs returned by the Web Service written by vs access the dataset? Such as using C ++ builder? [A] This is a good question. In fact, you only need c ++ builder to know how to process XML. For example, soap toolkit. [Q] snoic: Where can download petshop? [A] http://www.gotdotnet.com/team/compare/petshop.aspx. [Q] aqiang: How do I use the program to implement the DSN in connectionstring when I connect to the. DBF File of FoxPro? [A] What kind of connectionstring do you want? Connectionstring is a string. [Q] Seahorse: the core technology of. NET is XML. Are you right? [A] Not all. Net Based on XML. [Q] w_z_y: SQL Server and appserver are on two machines respectively. Must appserver create an alias for SQL Server when connecting data? [A] Yes. The machine name in connection string cannot use localhost. The machine name of sqlserver should be used. [Q] Mouse: when the net framework is ported to the Linux platform. [A] http: // WWW.GO-MONO.ORG. [Q]: dance1969: How to import the record set retrieved from a file (saved with Save) to SQL Server through dataset. [A]: use dataset. Update (). [Q] icerain: But C ++ builder knows how to process XML. But is the dataset returned by Web Service also XML? [A] ADO. Net passes XML as the underlying media. [Q] dance1969: Is the table in dateset saved to a file? Is there a save method in the recordset of the old ado? Thank you. [A] dataset. writexml (). Net is based on XML and ADO. Net deals with XML substantially. [Q] ghj1976: icyer: Is it appropriate to use ADO. Net for a persistent connection? For example, the stock system. [A] No, ADO. NET is disconnected model. [Q] xiaohei: Can you tell me how to paging in stored procedure! [A] The simplest way is to pass two parameters to stored procedure, one being page index and the other being page size, and then use a cursor to select a record. [Q] How does letian: How does XML filter data? Thank you. [A] There are many ways to read data from dataset and use dataview or XQuery. Of course, XPath can also accomplish similar functions. [Q] Seven: I have installed the. NET Framework SDK but cannot run the *. aspx program. Why? (IIS is installed ). [A] you also need to run a file named asp_regiis and register it. [Q] How do other dataset programs returned by the Web Service written by icerain: VS access the dataset? Such as using C ++ builder? [A] it cannot be done, or it is very complicated. Because shared objects between different languages require complex interface definitions. You can import the dataset into XML before passing it, so that the data is still saved. [Q] icyer: Cannot I run ASP. NET in Win98? What about the third-party event? [A] No. SP6 is required for NT. [Q] dance1969: How to import the record set retrieved from a file (saved with Save) to SQL Server through dataset. [A] You can still use dataadapter to store data back to the database, but you must ensure that the table structure of the database and the structure and relationship in the dataset are the same. [Q] Mouse: When the. NET Framework is ported to the Linux platform. [A] There is a Mono Project in Linux. [Q] maorachow: I want to use VC ++. net accesses Sybase and wants to use ADO. However, if I use managed VC ++, I may not be able to access the real-time library interface. Please tell me how to access Sybase through VC ++.. net. [A] InterOP technology that enables you use managed code from unmanaged world and vice versa. Please look for some InterOP sample in msdn. [Q] JEFFREY: In dataview, why does the find method have to query keys? Can it find multiple fields without keys? [A] No. Primarykey. [Q] javanow is required: I used the sqlcommand object after both sqlcommand and sqlconnection are dispose (). Why? It seems that dispose () is ignored? [A] This is related to the garbage collection. You can put your code and problems above csdn. It is possible that your idispose () excuse is not implemented well, so that the object is not destroyed immediately, and you still have to wait for. Net to regularly destroy the object, so that your problem may occur. [Q] dance1969: Can I use ADO. Net in Delphi 6. [A] You can also find information about delphi. net. [Q] lanyuai: Where can I find the. NET online support? [A] You can go to csdn, Tianji, and our newsgroup: msnews.microsoft.com. [Q] aqiang: Excuse me: "DSN = Visual FoxPro tables; uid =; Pwd =; sourcedb = c: \ Documents ents and Settings \ Administrator \ My Documents ENTs; sourcetype = DBF; exclusive = no; backgroundfetch = yes; collate = machine; null = yes; deleted = no; "How to Implement DSN in a program? [A] Have you ever used the above string to create an oledbconnection object? It should be OK, and then the data can be read as usual. [Q] Can this privatekey be customized In the table? This will not cause any problems when updating the data volume. [A] incorrect description. It should be primarykey. You can set it in datatable. [Q] What about letian: newsgroup? [A] msnews.microsoft.com. [Q] Ayou: How to apply an exclusive lock to the SQL server data table in the ADO. Net statement. [A] If ADO intransaction is used in ADO. net, SQL Server will be bound automatically when processing transaction. Alternatively, you can implement it in T-SQL. [Q] zhuho: How are ASP. NET applications abroad ?? [A] A lot. Take a look at ibuyspy. [Q] FFFF: how to convert ASP code into aspx code. [A] This is a big problem. It is not clear in a single sentence. In most cases, ASP code can be run directly on ASP. NET. You can refer to "migrating to ASP. NET: key considerations" in msdn ". [Q] Ayou: How do I use stored procedures in ADO. Net? [A] sqlcommand in sqladapter sets the type as stored procedure. [Q] Ayou: How do I use stored procedures in ADO. Net? [A] Your problem is too big. You can go to msdn to find an example. [Q] zhuho: Can you recommend a good C # book ?? [A] essencial C #. [Q] How do I execute this stored procedure in the Stored Procedure ADO. net for the returned result set and retrieve this dataset? [A] The parameter of command can be set to different types, such as in, output, and result. In this way, the returned results in stored procedure can be taken. [Q] FFFF: Developing ASP. NET what is better software Microsoft provides. [A] It is still Visual Studio. NET. [Q] Ayou: How do I use stored procedures in ADO. Net? Can I give a specific instance address? [A] updatecommand. commandtype = commandtype. storedprocedure; [Q] Ayou: how to use stored procedures in ADO. Net? Can I give an address? How to use stored procedures in ADO. Net? [A] http://www.csdn.NET/expert/topic/865/865738.xml? Temp =. 6926081, csdn example. [Q] netsnail Il: Can selectcommand dynamically generate Parameters Based on commandtext. [A] When command text is the name of select statement or stored procedure, parameter needs to be manually added. Conclusion host guest_fanfan says: Thank you for participating in this Microsoft expert technical chat. Our chat time is ~ . Welcome to the same time next week ~ 5: 00) join Microsoft expert online chat: customize personalized Windows controls. host guest_fanfan says: If you have any questions, please join our newsgroup for further discussion. Our newsgroups have the following six: Workshop. DOTNET. ages. vchost guest_fanfan says: the Microsoft newsgroup server is msnews.microsoft.com.