Showing posts with label writes. Show all posts
Showing posts with label writes. Show all posts

Saturday, February 25, 2012

CeWriteRecordProps failling with a empty FILETIME field..

Hi All, Does anyone have already made an application that writes some data into the EDB Pocket database ? I′m trying to insert a record with a empty FILETIME field and I′m getting the Error 87 (INVALID_PARAMETER), I′ve tested with some date in the field and the record is added sucessfull, it seems that the database doesn′t accept anymore empty FILETIME fields? Is it true? I didn't find anything in the docs.
thanx in advance.
The CEPROPVAL is OEM dependent. Have you verified the behavior on other devices too? If that remains the same, I need to investigate further.|||

Hi Thiago,

Are you using CeWriteRecordProps (EDB)? If so, then yes you would get error if you are passing empty FILETIME field. Somehow, this is missed in documentation. We have a bug for that, and I would check the status.

Please pass non-empty FILETIME to get yourself unblocked. Sorry for the pain created.

Thanks,

Laxmi Narsimha Rao ORUGANTI, SQL Server Everywhere, Microsoft Corporation

|||

Hi Laxmi,

Thank you very much for your reply, I′m passing now a non-empty FILETIME and it's working very well, now I'm stuck in another function, a similar problem with the CeSeekDatabaseEx funcion, especially when used with the CEOID, BEGINNING, LAST or CURRENT flags.

In the documentation, MSDN says that isn't necessary to open the database with a sort order when seeking with these flags, but if I do this, get the same ERROR 87 (INVALID_PARAMETER).

The function only works (find a record sucessfully) when I open the database specifing a sort order.

Do you know something about this issue?


In the documentation is:


The ERROR_INVALID_PARAMETER may be returned in the following situations:

x. The database was opened without a specified sort order, and dwSeekType is
a value other than the following:
CEDB_SEEK_CEOID
CEDB_SEEK_BEGINNING
CEDB_SEEK_CURRENT
CEDB_SEEK_END.

All other seek types require the use of a sort order.

link: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcedata5/html/wce50lrfCeSeekDatabaseExEDB.asp

Thanx in advance,
Thiago

CeWriteRecordProps failling with a empty FILETIME field..

Hi All, Does anyone have already made an application that writes some data into the EDB Pocket database ? I′m trying to insert a record with a empty FILETIME field and I′m getting the Error 87 (INVALID_PARAMETER), I′ve tested with some date in the field and the record is added sucessfull, it seems that the database doesn′t accept anymore empty FILETIME fields? Is it true? I didn't find anything in the docs.
thanx in advance.
The CEPROPVAL is OEM dependent. Have you verified the behavior on other devices too? If that remains the same, I need to investigate further.|||

Hi Thiago,

Are you using CeWriteRecordProps (EDB)? If so, then yes you would get error if you are passing empty FILETIME field. Somehow, this is missed in documentation. We have a bug for that, and I would check the status.

Please pass non-empty FILETIME to get yourself unblocked. Sorry for the pain created.

Thanks,

Laxmi Narsimha Rao ORUGANTI, SQL Server Everywhere, Microsoft Corporation

|||

Hi Laxmi,

Thank you very much for your reply, I′m passing now a non-empty FILETIME and it's working very well, now I'm stuck in another function, a similar problem with the CeSeekDatabaseEx funcion, especially when used with the CEOID, BEGINNING, LAST or CURRENT flags.

In the documentation, MSDN says that isn't necessary to open the database with a sort order when seeking with these flags, but if I do this, get the same ERROR 87 (INVALID_PARAMETER).

The function only works (find a record sucessfully) when I open the database specifing a sort order.

Do you know something about this issue?


In the documentation is:


The ERROR_INVALID_PARAMETER may be returned in the following situations:

x. The database was opened without a specified sort order, and dwSeekType is
a value other than the following:
CEDB_SEEK_CEOID
CEDB_SEEK_BEGINNING
CEDB_SEEK_CURRENT
CEDB_SEEK_END.

All other seek types require the use of a sort order.

link: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcedata5/html/wce50lrfCeSeekDatabaseExEDB.asp

Thanx in advance,
Thiago

Tuesday, February 14, 2012

Cat insert textboxes values into a database table

Hello, my problem is that I have 2 textboxes and when the user writes somthing and clicks the submit button I want these values to be stored in a database table. I am using the following code but nothing seems to hapen. Do I have a problem with the Query (Insert)? Or do I miss something else. Please respond as I can't find this.

<%@.PageLanguage="C#"AutoEventWireup="true"CodeFile="Manufacturer2.aspx.cs"Inherits="Manufacturer2" %>

<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<htmlxmlns="http://www.w3.org/1999/xhtml">

<headrunat="server">

<title>Untitled Page</title>

</head>

<body>

<formid="form1"runat="server">

<div>

<asp:LabelID="Label1"runat="server"Text="Name"></asp:Label>

<asp:TextBoxID="TextBox1"runat="server"></asp:TextBox><br/>

<asp:LabelID="Label2"runat="server"Text="Password"></asp:Label>

<asp:TextBoxID="TextBox2"runat="server"></asp:TextBox>

<br/>

<br/>

<asp:ButtonID="Button1"runat="server"Text="Submit"OnClick="Button1_Click"/>

<asp:SqlDataSourceID="SqlDataSource1"runat="server"ConnectionString="<%$ ConnectionStrings:ConnectionString %>"

SelectCommand="INSERT INTO Manufacturer(Name, Password) VALUES (@.TextBox1, @.TextBox2)">

<SelectParameters>

<asp:ControlParameterControlID="TextBox1"Name="TextBox1"PropertyName="Text"/>

<asp:ControlParameterControlID="TextBox2"Name="TextBox2"PropertyName="Text"/>

</SelectParameters>

</asp:SqlDataSource>

</div>

</form>

</body>

</html>

erom:

<asp:SqlDataSourceID="SqlDataSource1"runat="server"ConnectionString="<%$ ConnectionStrings:ConnectionString %>"

SelectCommand="INSERT INTO Manufacturer(Name, Password) VALUES (@.TextBox1, @.TextBox2)">

user insert command not select command

InsertCommandType="Text" InsertCommand="INSERT INTO Manufacturer(Name, Password) VALUES (@.TextBox1, @.TextBox2)"

Hope this will help.|||

Hi u can go with the first reply which is secured one

or u can write like this

st="insert into x values(" & trim(t1.value & "," & t2.value & ")"

cmd.executenonquery

cmd is the command object

Thank u

Baba

Please remember to click "Mark as Answer" on this post if it helped you.

|||

I tried this one but it didn't work. I don't know what is happening. Again no stored data in my database. Do I also have to write something in .cs file??

Thank you for your reply

|||

erom:

o I also have to write something in .cs file??

You need to call the Insert method of the DataSource in the button click event.

SqlDataSource1.Insert()

below is the .aspx page code.

<asp:SqlDataSource ID="SqlDataSource1" runat="server" InsertCommand="INSERT INTO Manufacturer(Name, Password) VALUES ( @.T1 , @.T2 )" ConnectionString="<%$ ConnectionStrings:xxxx%>"> <InsertParameters> <asp:ControlParameter ControlID="TextBox1" DefaultValue="" PropertyName="Text" Name="T1" /> <asp:ControlParameter ControlID="TextBox2" DefaultValue="" PropertyName="Text" Name="T2" /> </InsertParameters> </asp:SqlDataSource>
|||

Unfortunately, I still can't store the values inthe table. My code is the above (for the .aspx file) - Tell me if what am I missing:

<asp:LabelID="Label1"runat="server"Text="Name"></asp:Label>

<asp:TextBoxID="TextBox1"runat="server"></asp:TextBox><br/>

<asp:LabelID="Label2"runat="server"Text="Password"></asp:Label>

<asp:TextBoxID="TextBox2"runat="server"></asp:TextBox>

<br/>

<br/>

<asp:ButtonID="Button1"runat="server"Text="Submit"/>

<asp:SqlDataSourceID="SqlDataSource1"runat="server"InsertCommand='INSERT INTO Manufacturer(Name, Password) VALUES (@.TextBox1, @.TextBox2)'

ConnectionString="<%$ ConnectionStrings:ConnectionString %>">

<InsertParameters>

<asp:ControlParameterControlID="TextBox1"DefaultValue=""Name="TextBox1"PropertyName="Text"/>

<asp:ControlParameterControlID="TextBox2"DefaultValue=""Name="TextBox2"PropertyName="Text"/>

</InsertParameters>

</asp:SqlDataSource>

And for the .cs file:

using System;

using System.Data;

using System.Data.SqlClient;

using System.Configuration;

using System.Collections;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

publicpartialclassManufacturer2 : System.Web.UI.Page

{

protectedvoid Page_Load(object sender,EventArgs e)

{

}

protectedvoid Button1_Click(object sender,EventArgs e)

{

SqlDataSource1.Insert();

}

}

|||

The page and the code looks fair enough. the only thing I suppose you are missing is the InsertCommandType=Text. This is just a small piece of try out. I'm interested in what response do you get when you press the button ? Has any error occurred or something like that?