Hi all
The Code is below but i will give you a brief over view first.
I am using C#, SQL Mobile and the CF2.0 with Merge Replication. My Primary
Keys are all "uniqueidentifier" types with default value of
(newsequentialid()) .
Problem is I am trying to save the results for a questioner to a Results
table and it does not work.
I have built a windows mobile control that all seems to be working fine when
the questions are completed it raises the event you see below handing out a
Data Table with all the answers in it.
I then open up a blank Data Table in a Data Set and merge the Data from the
Answers Data Table to the Blank Data Table.
This all seems to work fine, i have checked it by viewing the count, After i
have Merged the count is 18 on both tables which is correct.
But it is like when i call the Data Adaptor Update nothing is going into the
database and there is no error.
I have tried both
oDA.Update(oDS.Tables["Answers"]);
And
oDA.Update(oDS);
But still not saving. And as you can see below i have set up a command
builder.
My other concern is that the Primary Key is a Auto Generated
"uniqueidentifier" column. With a default value of (newsequentialid()).
And this column seems to be blank the whole time. Perhaps it only Generates
the GUID when the Data Adaptor is updated?
Any help would be welcome
### CODE ###
private void QA_Audit_QuestionsFinnished(object sender,
QuestionAnswerControl.QuestionsFinnishedEventArgs e)
{
DataTable dtAnswers = (DataTable)e.AnswersDataTable;
SqlCeCommand oCom = null;
SqlCeCommandBuilder oComBuild = null;
DataSet oDS = null;
SqlCeDataAdapter oDA = null;
string sSQL = "SELECT * FROM AuditResults WHERE 1=2";
try
{
oDS = new DataSet();
//Set the Locale for the DataSet.
//Use the current culture as the default.
oDS.Locale =
System.Globalization.CultureInfo.CurrentCulture;
oCom = DBConnection.GetLocalConnection().CreateCommand();
oCom.CommandText = sSQL;
oDA = new SqlCeDataAdapter(oCom);
oComBuild = new SqlCeCommandBuilder();
oComBuild.DataAdapter = oDA;
//Use the Combo Name for the data table name to.
if (oDS.Tables["Answers"] == null)
{
//Fill the DataTable People within the DataSet sqlDS
oDA.Fill(oDS, "Answers");
}
else
{
// Refresh the Employees DataSet.
oDS.Clear();
oDA.Fill(oDS, "Answers");
}
oDS.Tables["Answers"].BeginLoadData();
oDS.Tables["Answers"].Merge(dtAnswers);
oDS.Tables["Answers"].EndLoadData();
oDS.AcceptChanges();
oDA.Update(oDS.Tables["Answers"]);
}
catch (SqlCeException err)
{
GlobalErrorHandler.ErrHandler(err,
"QA_Audit_QuestionsFinnished");
}
finally
{
if (oDA != null) { oDA.Dispose(); }
}
//Close the form when done.
this.Close();
}
### END CODE ####
Thanks,
ink 3 1324
Try to write shorter questions, and smobody will actually read it!
And then, if you are lucky, provide you with an answer.
"iKiLL" <iK***@NotMyEmail.comwrote in message
news:ed**************@TK2MSFTNGP02.phx.gbl...
Hi all
The Code is below but i will give you a brief over view first.
I am using C#, SQL Mobile and the CF2.0 with Merge Replication. My Primary
Keys are all "uniqueidentifier" types with default value of
(newsequentialid()) .
Problem is I am trying to save the results for a questioner to a Results
table and it does not work.
I have built a windows mobile control that all seems to be working fine
when the questions are completed it raises the event you see below handing
out a Data Table with all the answers in it.
I then open up a blank Data Table in a Data Set and merge the Data from
the Answers Data Table to the Blank Data Table.
This all seems to work fine, i have checked it by viewing the count, After
i have Merged the count is 18 on both tables which is correct.
But it is like when i call the Data Adaptor Update nothing is going into
the database and there is no error.
I have tried both
oDA.Update(oDS.Tables["Answers"]);
And
oDA.Update(oDS);
But still not saving. And as you can see below i have set up a command
builder.
My other concern is that the Primary Key is a Auto Generated
"uniqueidentifier" column. With a default value of (newsequentialid()).
And this column seems to be blank the whole time. Perhaps it only
Generates the GUID when the Data Adaptor is updated?
Any help would be welcome
### CODE ###
private void QA_Audit_QuestionsFinnished(object sender,
QuestionAnswerControl.QuestionsFinnishedEventArgs e)
{
DataTable dtAnswers = (DataTable)e.AnswersDataTable;
SqlCeCommand oCom = null;
SqlCeCommandBuilder oComBuild = null;
DataSet oDS = null;
SqlCeDataAdapter oDA = null;
string sSQL = "SELECT * FROM AuditResults WHERE 1=2";
try
{
oDS = new DataSet();
//Set the Locale for the DataSet.
//Use the current culture as the default.
oDS.Locale =
System.Globalization.CultureInfo.CurrentCulture;
oCom = DBConnection.GetLocalConnection().CreateCommand();
oCom.CommandText = sSQL;
oDA = new SqlCeDataAdapter(oCom);
oComBuild = new SqlCeCommandBuilder();
oComBuild.DataAdapter = oDA;
//Use the Combo Name for the data table name to.
if (oDS.Tables["Answers"] == null)
{
//Fill the DataTable People within the DataSet sqlDS
oDA.Fill(oDS, "Answers");
}
else
{
// Refresh the Employees DataSet.
oDS.Clear();
oDA.Fill(oDS, "Answers");
}
oDS.Tables["Answers"].BeginLoadData();
oDS.Tables["Answers"].Merge(dtAnswers);
oDS.Tables["Answers"].EndLoadData();
oDS.AcceptChanges();
oDA.Update(oDS.Tables["Answers"]);
}
catch (SqlCeException err)
{
GlobalErrorHandler.ErrHandler(err,
"QA_Audit_QuestionsFinnished");
}
finally
{
if (oDA != null) { oDA.Dispose(); }
}
//Close the form when done.
this.Close();
}
### END CODE ####
Thanks,
ink
Your first mistake is in assuming that a uniqueidentifier field in SQL is a
GUID when you set the default to newsequentialid(). Take a look at the table
in SQL and I bet you'll find the uniqueidentifier field is actually an int.
--
Neil Cowburn
Principal Partner
OpenNETCF Consulting, LLC.
Managed Code in the Embedded World http://www.opennetcf.com/ http://www.smartdeviceframework.com/
"iKiLL" <iK***@NotMyEmail.comwrote in message
news:ed**************@TK2MSFTNGP02.phx.gbl...
Hi all
The Code is below but i will give you a brief over view first.
I am using C#, SQL Mobile and the CF2.0 with Merge Replication. My Primary
Keys are all "uniqueidentifier" types with default value of
(newsequentialid()) .
Problem is I am trying to save the results for a questioner to a Results
table and it does not work.
I have built a windows mobile control that all seems to be working fine
when the questions are completed it raises the event you see below handing
out a Data Table with all the answers in it.
I then open up a blank Data Table in a Data Set and merge the Data from
the Answers Data Table to the Blank Data Table.
This all seems to work fine, i have checked it by viewing the count, After
i have Merged the count is 18 on both tables which is correct.
But it is like when i call the Data Adaptor Update nothing is going into
the database and there is no error.
I have tried both
oDA.Update(oDS.Tables["Answers"]);
And
oDA.Update(oDS);
But still not saving. And as you can see below i have set up a command
builder.
My other concern is that the Primary Key is a Auto Generated
"uniqueidentifier" column. With a default value of (newsequentialid()).
And this column seems to be blank the whole time. Perhaps it only
Generates the GUID when the Data Adaptor is updated?
Any help would be welcome
### CODE ###
private void QA_Audit_QuestionsFinnished(object sender,
QuestionAnswerControl.QuestionsFinnishedEventArgs e)
{
DataTable dtAnswers = (DataTable)e.AnswersDataTable;
SqlCeCommand oCom = null;
SqlCeCommandBuilder oComBuild = null;
DataSet oDS = null;
SqlCeDataAdapter oDA = null;
string sSQL = "SELECT * FROM AuditResults WHERE 1=2";
try
{
oDS = new DataSet();
//Set the Locale for the DataSet.
//Use the current culture as the default.
oDS.Locale =
System.Globalization.CultureInfo.CurrentCulture;
oCom = DBConnection.GetLocalConnection().CreateCommand();
oCom.CommandText = sSQL;
oDA = new SqlCeDataAdapter(oCom);
oComBuild = new SqlCeCommandBuilder();
oComBuild.DataAdapter = oDA;
//Use the Combo Name for the data table name to.
if (oDS.Tables["Answers"] == null)
{
//Fill the DataTable People within the DataSet sqlDS
oDA.Fill(oDS, "Answers");
}
else
{
// Refresh the Employees DataSet.
oDS.Clear();
oDA.Fill(oDS, "Answers");
}
oDS.Tables["Answers"].BeginLoadData();
oDS.Tables["Answers"].Merge(dtAnswers);
oDS.Tables["Answers"].EndLoadData();
oDS.AcceptChanges();
oDA.Update(oDS.Tables["Answers"]);
}
catch (SqlCeException err)
{
GlobalErrorHandler.ErrHandler(err,
"QA_Audit_QuestionsFinnished");
}
finally
{
if (oDA != null) { oDA.Dispose(); }
}
//Close the form when done.
this.Close();
}
### END CODE ####
Thanks,
ink
Hi Neil
It is defiantly a GUID, I have set the RowGUID Property to Yes for
Replication. And if i insert a row at the server this is the result, this
looks like a GUID to me "7e78fe39-ded2-db11-900f-000c291f3152"
Sorry about the spacing on the Question, When i posted the Message it was
not that big. Something has happened to it.
Do you think that perhaps the problem is the Command Builder?
Thanks,
ink
"Neil Cowburn" <ne***@nospam.opennetcf.comwrote in message
news:E1**********************************@microsof t.com...
Your first mistake is in assuming that a uniqueidentifier field in SQL is
a GUID when you set the default to newsequentialid(). Take a look at the
table in SQL and I bet you'll find the uniqueidentifier field is actually
an int.
--
Neil Cowburn
Principal Partner
OpenNETCF Consulting, LLC.
Managed Code in the Embedded World
http://www.opennetcf.com/ http://www.smartdeviceframework.com/
"iKiLL" <iK***@NotMyEmail.comwrote in message
news:ed**************@TK2MSFTNGP02.phx.gbl...
>Hi all The Code is below but i will give you a brief over view first. I am using C#, SQL Mobile and the CF2.0 with Merge Replication. My Primary Keys are all "uniqueidentifier" types with default value of (newsequentialid()) . Problem is I am trying to save the results for a questioner to a Results table and it does not work. I have built a windows mobile control that all seems to be working fine when the questions are completed it raises the event you see below handing out a Data Table with all the answers in it. I then open up a blank Data Table in a Data Set and merge the Data from the Answers Data Table to the Blank Data Table. This all seems to work fine, i have checked it by viewing the count, After i have Merged the count is 18 on both tables which is correct. But it is like when i call the Data Adaptor Update nothing is going into the database and there is no error. I have tried both oDA.Update(oDS.Tables["Answers"]); And oDA.Update(oDS); But still not saving. And as you can see below i have set up a command builder. My other concern is that the Primary Key is a Auto Generated "uniqueidentifier" column. With a default value of (newsequentialid()).
And this column seems to be blank the whole time. Perhaps it only Generates the GUID when the Data Adaptor is updated?
Any help would be welcome
### CODE ###
private void QA_Audit_QuestionsFinnished(object sender, QuestionAnswerControl.QuestionsFinnishedEventAr gs e) { DataTable dtAnswers = (DataTable)e.AnswersDataTable; SqlCeCommand oCom = null; SqlCeCommandBuilder oComBuild = null; DataSet oDS = null; SqlCeDataAdapter oDA = null; string sSQL = "SELECT * FROM AuditResults WHERE 1=2";
try { oDS = new DataSet();
//Set the Locale for the DataSet. //Use the current culture as the default. oDS.Locale = System.Globalization.CultureInfo.CurrentCulture ;
oCom = DBConnection.GetLocalConnection().CreateCommand(); oCom.CommandText = sSQL;
oDA = new SqlCeDataAdapter(oCom);
oComBuild = new SqlCeCommandBuilder(); oComBuild.DataAdapter = oDA;
//Use the Combo Name for the data table name to. if (oDS.Tables["Answers"] == null) { //Fill the DataTable People within the DataSet sqlDS oDA.Fill(oDS, "Answers"); } else { // Refresh the Employees DataSet. oDS.Clear(); oDA.Fill(oDS, "Answers"); }
oDS.Tables["Answers"].BeginLoadData(); oDS.Tables["Answers"].Merge(dtAnswers); oDS.Tables["Answers"].EndLoadData(); oDS.AcceptChanges(); oDA.Update(oDS.Tables["Answers"]);
} catch (SqlCeException err) { GlobalErrorHandler.ErrHandler(err, "QA_Audit_QuestionsFinnished"); } finally { if (oDA != null) { oDA.Dispose(); } } //Close the form when done. this.Close(); }
### END CODE ####
Thanks,
ink This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Bonj |
last post by:
Hi
I've been following the example on
http://aspnet.4guysfromrolla.com/articles/071002-1.3.aspx
and no matter what I do, i can't get the DataGrid1_EditCommand event handler
to fire. Could...
|
by: headware |
last post by:
I'm relatively new to ASP.NET and ADO.NET, but I have a basic design
question regarding the use of web services and APS.NET applications.
Right now we have an application that uses web services to...
|
by: marcmc |
last post by:
Hey, I have never used a datagrid/dataset/adaptor/table method for updating
data, I have always used direct updates to the database so ADO is quite new
to me.
I have a datagrid and I change a...
|
by: Darhl Thomason |
last post by:
Does VB2005 have a wizard for creating a form based on an Access db? I know
that VB6 had this, but I can't seem to find anything similar in VB2005.
Thanks!
Darhl
|
by: shwetagupta |
last post by:
Hi
I am Trying to insert data in M S Access through ASP, but it is neither showing any error nor updating the database. Please tell me ,where i am making the mistake
code:
<html>
<%
set...
| |
by: Greg Lyles |
last post by:
Hi all,
I'm trying to develop an ASP.NET 2.0 website and am running into some
real problems with what I thought would be a relatively simple thing
to do.
In a nutshell, I'm stuck on trying to...
|
by: sheenaa |
last post by:
Hello Members,
I m creating my application forms in ASP.Net 2005 C# using the backend SQL Server 2005.
What i have used on forms :: ?
On my first form i have used some...
|
by: rustyc |
last post by:
Well, here's my first post in this forum (other than saying 'HI' over in the hi forum ;-)
As I said over there:
... for a little side project at home, I'm writing a ham radio web site in...
|
by: Wavey |
last post by:
Hi All,
I have a problem with updating an Access database from a datatable. I have two rows of data in my database at the moment for testing, the first row is an ID number (primary key), the...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |