Jump to content

Error while connecting to database


vadder85

Recommended Posts

hi..hope anyone can help me solve this problem I'm quite new in this area..got problem when trying to connect to database as I would like to retrieve all the info in the database into my mobile web pages... While I'm trying, an error message came out "non mobile control are permitted inside the templates.Please delete this control or move it into the template"...where's actually the template?and is the way to connect to database from mobile web pages and normal web pages same?..can some one help me..tq~~

Link to comment
Share on other sites

you need to post your code so we can find the error
actually it happened when I drag the AccessDataSource/SqlDataSource/wat ever data source( in mobile web form menu) into List..An alert window will appear with those message that I've mentioned above..or do you know wat is the right way to display data from database in List..(but in mobile web form not normal web form)..tq
Link to comment
Share on other sites

There isn't much out there on that error. but basically it means you cannot use that control because it is not a mobile control. I don't know what a template is or hwo they are used.Is there a specific DataSourceObject for mobile apps?I would recommend taking your quesation to forums.asp.net also.

Link to comment
Share on other sites

There isn't much out there on that error. but basically it means you cannot use that control because it is not a mobile control. I don't know what a template is or hwo they are used.Is there a specific DataSourceObject for mobile apps?I would recommend taking your quesation to forums.asp.net also.
For your information, I've tried to debug the application..an error occur and said asp:listbox cannot be a top-level form element..what's that mean?
Link to comment
Share on other sites

I really need to see the code and to have the EXACT error message word for word.
Here's the code<%@ Page Language="VB" AutoEventWireup="false" CodeFile="store_directory.aspx.vb" Inherits="store_directory" %><%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %><html xmlns="http://www.w3.org/1999/xhtml" ><body> <mobile:Form id="Form1" runat="server" BackColor="#80FFFF"> <mobile:Label ID="Label1" Runat="server" Font-Bold="True" Font-Name="Century Gothic">Store Directory</mobile:Label><br /><br /><mobile:Image ID="Image1" Runat="server" Alignment="Left" ImageUrl="~/images/Paper_Shopping_Bags.gif"></mobile:Image>  <asp:accessdatasource id="AccessDataSource1" runat="server" datafile="~/db1.mdb" selectcommand="SELECT [store_name] FROM [store_info]"></asp:accessdatasource>  <asp:objectdatasource id="ObjectDataSource1" runat="server"></asp:objectdatasource>  </mobile:Form>  <asp:accessdatasource id="AccessDataSource2" runat="server" datafile="C:\Inetpub\wwwroot\MIK2007\db1.mdb" deletecommand="DELETE FROM `store_info` WHERE `id` = ?" insertcommand="INSERT INTO `store_info` (`id`, `store_name`) VALUES (?, ?)" selectcommand="SELECT `id`, `store_name` FROM `store_info`" updatecommand="UPDATE `store_info` SET `store_name` = ? WHERE `id` = ?"><InsertParameters><asp:Parameter Type="Int32" Name="id"></asp:Parameter><asp:Parameter Type="String" Name="store_name"></asp:Parameter></InsertParameters><DeleteParameters><asp:Parameter Type="Int32" Name="id"></asp:Parameter></DeleteParameters><UpdateParameters><asp:Parameter Type="String" Name="store_name"></asp:Parameter><asp:Parameter Type="Int32" Name="id"></asp:Parameter></UpdateParameters></asp:accessdatasource></body></html>or..do you actually know the right way to connect to a database and later on display/retrieve info from the database in List..(BUT using Mobile Web Forms)
Link to comment
Share on other sites

When using mobile.net all tags have to have <mobile:try <mobile:accessdatasource.....
I've tried your solution but it failed..it stated that "Unknown server tag"..do you know other way on how to solve this problem?or it is better for me to use normal asp web form toin order to develop and view it from mobile devices such as PDA?
Link to comment
Share on other sites

I've tried your solution but it failed..it stated that "Unknown server tag"..do you know other way on how to solve this problem?or it is better for me to use normal asp web form toin order to develop and view it from mobile devices such as PDA?
If you can using normal webforms would be easiest but make sure your target devices have XHTML enabled browsers, some only can view WML.
Link to comment
Share on other sites

If you can using normal webforms would be easiest but make sure your target devices have XHTML enabled browsers, some only can view WML.
maybe it should be okay as my target device is PDA and Smartphone..that's mean I have to adjust the interface until it fits the screen of PDA or Smartphone..any idea on that way?
Link to comment
Share on other sites

smartphone Resolutions: 176x220, 160x240, 208x240 (176x220 for most Smartphones).PDA resolutions 240x160 (palm)320x240 (palm & windows mobile pre 2003v2)640x480 (windows mobile 2003v2)
i've tried by using vs 2003 and managed to follow all the steps but when i debug,error message come out...like this"The Microsoft Jet database engine cannot open the file 'C:\Inetpub\wwwroot\MobileWebApplication1\store_info.mdb'. It is already opened exclusively by another user, or you need permission to view its data."what's that mean?Line 90: Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.LoadLine 91: 'Put user code to initialize the page hereLine 92: OleDbDataAdapter1.Fill(DataSet11, "store")Line 93: List1.DataBind()Line 94: How to solve?
Link to comment
Share on other sites

check the permissions on the database file and make sure to give NETWORK SERVICE (WinServer 2003 or ASPNET on WinXP) permission to read/write/modify the database. Make sure also that every folder in the path has the same permissions.

Link to comment
Share on other sites

check the permissions on the database file and make sure to give NETWORK SERVICE (WinServer 2003 or ASPNET on WinXP) permission to read/write/modify the database. Make sure also that every folder in the path has the same permissions.
sorry, I cannot understand your answer.can you be more specifically?
Link to comment
Share on other sites

check the permissions on the database file and make sure to give NETWORK SERVICE (WinServer 2003 or ASPNET on WinXP) permission to read/write/modify the database. Make sure also that every folder in the path has the same permissions.
sorry, I cannot understand your answer.can you be more specifically?
Link to comment
Share on other sites

First off I will assume you are using windows XP if you are using Windows server 2003 replace ASPNET with NETWORK SERVICE int he instructions belowright click on your database file.Choose Properties -> Select Security tablook for a user called ASPNET. If it is not there Click the Add button and type in ASPNET. Then change that users permissions to have "Full Control".Close all dialogs and try your code again.

Link to comment
Share on other sites

First off I will assume you are using windows XP if you are using Windows server 2003 replace ASPNET with NETWORK SERVICE int he instructions belowright click on your database file.Choose Properties -> Select Security tablook for a user called ASPNET. If it is not there Click the Add button and type in ASPNET. Then change that users permissions to have "Full Control".Close all dialogs and try your code again.
tq!!! i managed to retrieve the data...tq bro!!!
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...