dataSet1.ReadXml("kwyProducts.xml");
dataGridView1.DataSource =
dataSet1;
dataGridView1.DataMember = "KWYProducts";
Notes: please specify your DataMember correctly else will throw you this error:
Child list for field KWYProduscts cannot be created.
Child list for field KWYProduscts cannot be created.
Use Master
RESTORE DATABASE DinnerNow FROM
DISK = 'C:\DinnerNow.bak' WITH MOVE
'DinnerNownew' TO
'F:\Program Files\Microsoft SQL
Server\MSSQL.4\MSSQL\Data\DinnerNownew.mdf', MOVE 'DinnerNownew_log' TO
'F:\Program Files\Microsoft SQL
Server\MSSQL.4\MSSQL\Data\DinnerNownew.ldf'
GO
//instantiate a dictionary list
Dictionary_PointDic = new
Dictionary();
public Dictionary
PointDic
{
get { return _PointDic; }
set { _PointDic = value; }
}
//add value to named key
public void AddPoints(int point, string
ruleName)
{
int temp = 0;
if (!_PointDic.TryGetValue(ruleName, out
temp))
{
_PointDic.Add(ruleName,
point);
}
else
{
_PointDic.Remove(ruleName);
_PointDic.Add(ruleName,
point);
}
}
//sum up the values in the dictionary list
public int
CalculatePoints()
{
int totalpoints = 0;
foreach
(KeyValuePairs in _PointDic)
{
totalpoints +=
(int)s.Value;
}
return totalpoints;
}
Try this code it will help.
public Int64 AddCustomer(string LastName, string FirstName, int?
AddressID, string MembershipUsername, string PhoneNumber, string
MobilePhoneNumber)
{
SQLCeHelper sqlce = new
SQLCeHelper(Properties.Settings.Default.CarServ3DB4ConnectionString);
string
queryString =
"INSERT INTO Customer" +
"(LastName, FirstName, AddressID,
MembershipUsername, PhoneNumber, MobilePhoneNumber)" +
"VALUES
(@LastName,@FirstName,@AddressID,@MembershipUsername,@PhoneNumber,@MobilePhoneNumber)";
Int64
newIdentity = 0;
using (SqlCeConnection connection = new
SqlCeConnection(
Properties.Settings.Default.CarServ3DB4ConnectionString))
{
SqlCeCommand
command = new SqlCeCommand(queryString,
connection);
command.Connection.Open();
command.Parameters.Add("@LastName",
LastName);
command.Parameters.Add("@FirstName",
FirstName);
command.Parameters.Add("@AddressID", (object)AddressID??
DBNull.Value );
command.Parameters.Add("@MembershipUsername",
MembershipUsername);
command.Parameters.Add("@PhoneNumber",
PhoneNumber);
command.Parameters.Add("@MobilePhoneNumber",
MobilePhoneNumber);
command.ExecuteNonQuery();
SqlCeCommand command1 = new
SqlCeCommand("select @@identity ", connection);
newIdentity =
Convert.ToInt32(command1.ExecuteScalar());
}
return
newIdentity;
}