HI,
I am making my university website for mobile devices in VS 2005. I want my users to give their name and address using this website to order a prospectus. So when I deploy my application and insert name and address which should go into my database I created in
SQL server Mobile edition. The record does not go into the database. I refreshed the database. I am watching the same database which is running but it is not showing the record in the datatable. I am sending you a copy of my code.
Whilst your code is very open to SQL injection attack (look at the use of filter functions as in the common library I posted within thread http://forums.asp.net/thread/1631102.aspx), the code itself looks to be good. Please post the table definition of
ProspectiveStudent.
Click "Mark as Answer" on the post that helped you.
This earns you a point and marks your thread as Resolved so we will all know you have been helped.
FAQ on the correct forum http://forums.asp.net/p/1337412/2699239.aspx#2699239
I think by table definition you mean what are the columns in this table. So in ProspectiveStudent table columns are Name, Address, PostCode and StudentID.
I do not understand why you are using the .NET Compact Framework for your "university website for mobile devices". It has nothing to do with web applications.
Do you have a web server like IIS or Apache or web space in shared hosting with IIS or Apache which is accessible for the users which you want to reach? Do you have a database server? This database server, e. g. SQL Server or MySQL, has to be connected to
the web server machine.
If you have IIS you can use the ASP.NET Mobile Controls for your application. Then you have to use Mobile Web Forms in Visual Studio.
I dont have to make a real mobile websites for students. It is my MSc. project to show my teacher that how would a real university's website will look like. I am making in visual studio 2005 so that I can show my teacher how to make a website for a mobile
devices and that's all. This is why I am using .net compact framework and SQL Mobile server which is built in VS 2005. If you can help me regarding my question. I would be grateful.
ambreen
0 Points
12 Posts
how to insert a record from mobile application into database
Apr 28, 2007 03:40 PM|LINK
I am making my university website for mobile devices in VS 2005. I want my users to give their name and address using this website to order a prospectus. So when I deploy my application and insert name and address which should go into my database I created in SQL server Mobile edition. The record does not go into the database. I refreshed the database. I am watching the same database which is running but it is not showing the record in the datatable. I am sending you a copy of my code.
private void btnSubmit_Click(object sender, EventArgs e)
{
SqlCeConnection con = new SqlCeConnection();
con.ConnectionString = ("Data Source = "
+ (System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) + "\\university.sdf;"));
SqlCeCommand cmdAddPros = new SqlCeCommand();
cmdAddPros.Connection = con;
cmdAddPros.CommandText = String.Format("insert into ProspectiveStudent (Name,Address,PostCode) Values('{0}','{1}','{2}')", txtName.Text, txtAddress.Text, txtPostCode.Text);
con.Open();
int intcount = cmdAddPros.ExecuteNonQuery();
con.Close();
}
if anyone can help me I will be grateful
TATWORTH
All-Star
72405 Points
14018 Posts
MVP
Re: how to insert a record from mobile application into database
Apr 29, 2007 11:00 AM|LINK
This earns you a point and marks your thread as Resolved so we will all know you have been helped.
FAQ on the correct forum http://forums.asp.net/p/1337412/2699239.aspx#2699239
ambreen
0 Points
12 Posts
Re: how to insert a record from mobile application into database
Apr 29, 2007 11:53 AM|LINK
I think by table definition you mean what are the columns in this table. So in ProspectiveStudent table columns are Name, Address, PostCode and StudentID.
thanks,
Ambreen
SKT_01
Participant
1930 Points
435 Posts
Re: how to insert a record from mobile application into database
Apr 29, 2007 12:09 PM|LINK
ambreen
0 Points
12 Posts
Re: how to insert a record from mobile application into database
Apr 29, 2007 01:32 PM|LINK
then what do you suggest
r0cky_f
Member
44 Points
87 Posts
Re: how to insert a record from mobile application into database
Apr 29, 2007 02:02 PM|LINK
is it a mobile application or mobile web app??
is the database mobile version or standard version??
i'm currently doing the same project as yours but i'm having the difficulty at connecting to sql server 2005 express
SKT_01
Participant
1930 Points
435 Posts
Re: how to insert a record from mobile application into database
Apr 29, 2007 02:09 PM|LINK
Do you have a web server like IIS or Apache or web space in shared hosting with IIS or Apache which is accessible for the users which you want to reach? Do you have a database server? This database server, e. g. SQL Server or MySQL, has to be connected to the web server machine.
If you have IIS you can use the ASP.NET Mobile Controls for your application. Then you have to use Mobile Web Forms in Visual Studio.
ambreen
0 Points
12 Posts
Re: how to insert a record from mobile application into database
Apr 29, 2007 02:23 PM|LINK
Dear SKT_01,
I dont have to make a real mobile websites for students. It is my MSc. project to show my teacher that how would a real university's website will look like. I am making in visual studio 2005 so that I can show my teacher how to make a website for a mobile devices and that's all. This is why I am using .net compact framework and SQL Mobile server which is built in VS 2005. If you can help me regarding my question. I would be grateful.
ambreen
0 Points
12 Posts
Re: how to insert a record from mobile application into database
Apr 29, 2007 02:25 PM|LINK
Dear Rocky,
it is mobile web application. database is mobile version.
SKT_01
Participant
1930 Points
435 Posts
Re: how to insert a record from mobile application into database
Apr 29, 2007 02:42 PM|LINK
ambreen,
I think this is the wrong forum for your question.
You can try the forum for Smart Device Development on MSDN.