dataset err

  • Thread starter Thread starter One Handed Man [ OHM ]
  • Start date Start date
O

One Handed Man [ OHM ]

error
Object reference not set to an instance of an object.
at CarRentalWS.Service1.updateCity(DataSet ds) in ...

Dataset ds // Does nit instrantiate a new dataset, it simply declares the
object to be of DataSet type
 
hi i am trying to update a dataset in my client windows applicaton
and then pass that dataset to the web service so that it can update the
database..
i have operations like update, delete and insert.
im trying insert in teh following code and it doesnt work.
what am i doing wrong?



private void cmdSubmit_Click(object sender, System.EventArgs e)
{
DataRow dr = dsCity.Tables["city"].NewRow();
dr["cityname"]="newyork";
MessageBox.Show(dsCity.Tables["city"].Rows.Count.ToString()); //gives 2
dsCity.Tables["city"].Rows.Add(dr);
MessageBox.Show(dsCity.Tables["city"].Rows.Count.ToString()); //gives 3.
ser=new Service1();
ser.updateCity(dsCity);
}




[WebMethod]
public DataSet updateCity(DataSet ds)
{
SqlCommandBuilder cmdBuilder = new SqlCommandBuilder (daCity);
daCity.Update(ds.Tables["city"]);
return dsCity;
}


error
Object reference not set to an instance of an object.
at CarRentalWS.Service1.updateCity(DataSet ds) in ...


thanx
 
Back
Top