c# - Adding a new record to a typed dataset error -


i have used example msdn adding new record dataset. have used same variable names keep simple.

c# code

northwinddataset.customersrow newcustomersrow = northwinddataset1.customers.newcustomersrow();      newcustomersrow.customerid = "5";     newcustomersrow.companyname = "alfreds futterkiste";      northwinddataset1.customers.rows.add(newcustomersrow); 

the error getting the name 'northwinddataset1' not exist in current context

i find odd using code straight msdn.

my dataset called northwinddataset, table called customers. have tried northwinddataset still same error.

the code example snippet in msdn isn't designed complete. need variable called northwinddataset1 in order use snippet.

for example, use:

northwinddataset northwinddataset1 = new northwinddataset(); 

... although more you'd want fetch database data adapter, or such.

it's important try understand code being presented. if you're new typed data sets, should clear trying use existing variable - means in order use code, have have variable.

if you're sufficiently new c# don't understand syntax being used here (and there's nothing wrong being new, of course) suggest start off learning basics of c# before move onto database access. way when you're learning more advanced topics, you'll in better position. learning 1 thing @ time more efficient trying learn in 1 go.

my dataset called northwinddataset

what exactly mean that? mean data set type, or have property called northwinddataset somewhere? needs create instance of data set type @ point... it's not clear how far you've got that.


Comments

Popular posts from this blog

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -