hi

i'm tryin to get data from my windows form that is 1st stored in a dataset then stored later in a local database(.sdf). this is the code i'm trying to use on the save button clock event.

Dim houseType As String = me.housingType.selectedValue
Dim desc As String = Me.housingDescription.Text

Dim newRow As DataRow = TMSDataSet

......... my 1st problem is here because i get errors when i try to call the new row method.

my 2nd problem is more of a question. Do i have to always insert my form data in a dataset before storing it in the database?

danielagaba,
You must have to use .mdf (sql server database) not .sdf(sql server database compact).

i'm abit confused. i'd read that for windows app development, a local database (.sdf) is better if making an app with its own internal database. Could explain just abit more?
will i still need the dataset?

Compact sql server (.sdf) is used with device application. Use .mdf (server database) for web, window and other development. Of course you need a DataSet.

thanx a bunch. But i still cant get my data inserted into the dataset.
At the point where i declare a datarow ( Dim dr As DataRow = DataSet.DataTable.NewRow), it brings an error saying "reference to a non-shared member required object reference"

Here is code for your concern,

Dim Cn as New SqlConnection("connection string....")
  Dim Adp as new SqlDataAdapter("select * fromTableName",Cn)
  ...
  Dim Ds as New DataSet
  Adp.Fill(Ds,"TableName")
  Dim dr as DataRow
  dr=Ds.Tables("TableName").NewRow()
  dr(0)=10
  dr(1)="Mr. A"
  ....
  Ds.Tables("TableName").Rows.Add(dr)
  Adp.Update(Ds,"TableName")

thanx

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.