Click here to Skip to main content
15,885,767 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
DataSet ds = new DataSet();
DataTable dt = new DataTable();
DataColumn dc1 = new DataColumn("parametername");
DataColumn dc2 = new DataColum("parametervalue");
dt.Columns.Add(dc1);
dt.Columns.Add(dc2);
ds.Tables.Add(dt);
DataRow dr = ds.Tables[0].NewRow();
SomeService.RemRequest Treq = new SomeService.RemRequest();
Treq.ModuleName = Some.Common.Warehouse.TransitConstant.ModuleName.somemodule;
Treq.FunctionName = "search";
Treq.UserRid = 63913;
dr[0] = "keyword";
dr[1] = txtSearch.Text;
dt.Rows.Add(dr);
DataRow dr2 = ds.Tables[0].NewRow();
dr2[0] = "class";
dr2[1] = "687";
dt.Rows.Add(dr2);

--------------------------------------------------------------------------

get an error Object reference not set to an instance of an object

[edit]Code block added - OriginalGriff[/edit]
Posted
Updated 24-Feb-11 9:39am
v3
Comments
Toli Cuturicu 24-Feb-11 16:10pm    
Where exactly do you get this error?! At which line?

1 solution

You will need to check where you are trying to use a null object. From your code, I think it should be here:

Treq.ModuleName = Some.Common.Warehouse.TransitConstant.ModuleName.somemodule;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900