views:

723

answers:

3

Hi everyone,

I am trying to create an integrated project in which I can update MS-SQL's database value using J2ME's application.

But I need more resources/links that let me fully understand how to go about writing implementation for this.

These are the few question in which I've got in mind.

  1. How do I update the data that I've got from J2ME into MSSQL 2005?
  2. How do I retrieve and view the updated value from the database?
  3. How do I send sms to the J2ME's application, as the other application of mine need to send an 'alert' to the j2me app.
+1  A: 

Short of writing your own ODBC library for J2ME, I would suggest you look at writing a web service layer over your database which the J2ME application can communicate with over HTTP.

roryf
A: 

so am i right by saying, i create a normal web services that has method to update the field in the database like i do normally in ADO.NET, pass in the value from j2me using plugin like kxml?

A: 

alright theres an update on my progress here, but i've got an error

while creating a webmethod, when i tried to test the webmethod and input value, the values in the SQL database has not been changed, i need some advice here in what went wrong? thanks in advance =)

[WebMethod]
public void updateLighting(string strLighting_Status, int ID)
{
    string strConnection = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
    SqlConnection mySqlConnection = new SqlConnection(strConnection);
    mySqlConnection.Open();
    SqlTransaction mySqlTransaction = mySqlConnection.BeginTransaction();
    SqlCommand mySqlCommand = mySqlConnection.CreateCommand();
    mySqlCommand.Transaction = mySqlTransaction;

    string updateStatement = "UPDATE Lighting_Control SET Lighting_Status = @Lighting_Status WHERE ID = @ID";

    mySqlCommand.CommandText = updateStatement;
    mySqlCommand.Parameters.Add("@Lighting_Status", strLighting_Status);
    mySqlCommand.Parameters.Add("@ID", ID);

    mySqlCommand.ExecuteNonQuery();
}
This is a different issue to what you originally posted, I suggest you start a new question that is more specific to your ADO.NET problem.
roryf
Have you tested these web methods on the server with standalone unit tests? This will ensure that they work. Then all you need to do is to figure out the J2ME part of it.
omermuhammed