table:UserTypes
Fields:row,name,Type
This code is not working:
Int64 row = 1;
var myType = (from b in dc.UserTypes where b.Row == user.Row select b).Single();
myType.Type = "personalPage";
dc.SubmitChanges();
But, this code does...dc.ExecuteQuery<UserType >("update dbo.UserType set Type='personalPage' where row={0}",user.Row
);
I get this error:
Type the word is a word reserved.i can not user word
Type
EDIT
dbml
[Table(Name="dbo.UserType")]
public partial class UserType
{
private long _Row;
private string _Type;
public UserType()
{
}
[Column(Storage="_Row", DbType="BigInt NOT NULL")]
public long Row
{
get
{
return this._Row;
}
set
{
if ((this._Row != value))
{
this._Row = value;
}
}
}
[Column(Storage="_Type", DbType="NVarChar(500) NOT NULL", CanBeNull=false)]
public string Type
{
get
{
return this._Type;
}
set
{
if ((this._Type != value))
{
this._Type = value;
}
}
}
}
Go into your LINQ to SQL DBML mapping and change the mapping for UserType.Type
from being to a column named "Type" to a column named "[Type]". You can do this in the designer, or manually.
You can reference it as UserType.@Type
in your code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With