Madz Posted February 25, 2003 Posted February 25, 2003 I am having a problem I have a connections which i accessing data from a database. after connecting a database i am filling a dataset with a table and showing results in a Grid. i grid i change many values but these values are not commited to database is there any way so i could be able to commit that dataset back to there from where it was originated Quote The one and only Dr. Madz eee-m@il
Leaders quwiltw Posted February 25, 2003 Leaders Posted February 25, 2003 Are you using the Update method on the dataadapter? Quote --tim
a_jam_sandwich Posted February 25, 2003 Posted February 25, 2003 Whats your code Look at the Update method with the CommandBuilder using the dataadapter this will do what you want Andy Quote Code today gone tomorrow!
Madz Posted February 26, 2003 Author Posted February 26, 2003 I am working on a project with which an administrator can enter informaton about his dealers and distributors. this is code of customers table this is the Dataset which i am using <?xml version="1.0" standalone="yes" ?> <xs:schema id="dtCustomers" targetNamespace="http://www.tempuri.org/dtCustomers.xsd" xmlns:mstns="http://www.tempuri.org/dtCustomers.xsd" xmlns="http://www.tempuri.org/dtCustomers.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" attributeFormDefault="qualified" elementFormDefault="qualified"> <xs:element name="dtCustomers" msdata:IsDataSet="true"> <xs:complexType> <xs:choice maxOccurs="unbounded"> <xs:element name="Customers"> <xs:complexType> <xs:sequence> <xs:element name="Name" type="xs:string" /> <xs:element name="Distributor" type="xs:boolean" /> <xs:element name="Dealer" type="xs:boolean" /> <xs:element name="Address" type="xs:string" /> <xs:element name="City" type="xs:string" /> <xs:element name="Phone" type="xs:string" /> <xs:element name="Fax" type="xs:string" minOccurs="0" /> </xs:sequence> </xs:complexType> </xs:element> </xs:choice> </xs:complexType> </xs:element> </xs:schema> next with a search button i am doing this filling the Dataset and Refreshing the Results in a Grid dsShowCustomers.Clear() On Error Resume Next If Not cboCity.Text = "" Then ' cbocity is a Combo Box in which some cities are listed. cmdSelectCustomer.CommandText = "Select Name, Distributor, Dealer, Address, City, Phone, Fax From Customers Where City = '" & cboCity.Text & "'" Debug.WriteLine(cmdSelectCustomer.CommandText) Else cmdSelectCustomer.CommandText = "Select Name, Distributor, Dealer, Address, City, Phone, Fax From Customers" End If mySQL.Open() cmdSelectCustomer.ExecuteNonQuery() mySQL.Close() myAdapter.Fill(dsShowCustomers) 'datagrid here dgCustomers.Refresh() Here i am able to generate the Dataset i am making changes in Data in DataGrid but i dont know how to send it back to Database here myAdapter.update(dataset) doesnot working. Is there any solution Quote The one and only Dr. Madz eee-m@il
Leaders quwiltw Posted February 26, 2003 Leaders Posted February 26, 2003 Have you set up the update/insert/delete commands? either manually or with commandbuilder? This link might help. http://samples.gotdotnet.com/quickstart/howto/doc/adoplus/UpdateDataFromDB.aspx Quote --tim
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.