Hi,
I am trying to link a Local Webservice that i made to display on a Window Phone App
This is Webservice Code:
public interface IService1
{
[OperationContract]
int CreateEvent(string Eventname, string Review, string rating);
[OperationContract]
int DeleteEvent(int EventID);
}
public int CreateEvent (string EventName ,string Review, string FullName )
{
ConnectionStringSettingsCollection collections = ConfigurationManager.ConnectionStrings;
string connectionString = collections["DBConnectionString"].ConnectionString;
SqlConnection sqlconn = new SqlConnection(connectionString);
sqlconn.Open();
SqlCommand insertCommand = sqlconn.CreateCommand();
insertCommand.CommandText
= "INSERT INTO Feedback VALUES ('" +EventName+ "','"+Review+"','"+FullName+"')";
int sucess = insertCommand.ExecuteNonQuery();
sqlconn.Close();
return sucess;
}
public int DeleteEvent (int EventID)
{
return 0;
}
}
I have also Created a Database .mdf file with a Feedback table with the 3 items that i want to save in
As for the window Phone Side I have linked the web service and used this code which i learned from school i am not sure what it do but i presume that it is to link the database through web service
private void TestWebService()
{
String Test = "Testing";
ServiceReference1.Service1Client clientForTesting = new ServiceReference1.Service1Client();
clientForTesting.GetDataUsingDataContractCompleted += clientForTesting_GetDataUsingDataContractCompleted;
clientForTesting.GetDataUsingDataContractAsync(Test);
}
private void clientForTesting_GetDataUsingDataContractCompleted(object sender, ServiceReference1.GetDataUsingDataContractCompletedEventArgs e)
{
if (e.Error != null)
{ MessageBox.Show(e.Error.ToString()); }
else
{
}
}
This is the binding code which i use
</StackPanel>
<TextBox Text="{Binding EventName, Mode=TwoWay}" HorizontalAlignment="Left" Height="72" TextWrapping="Wrap" VerticalAlignment="Top" Width="316" Margin="154,87,0,0" Grid.Row="1"/>
<TextBox Text="{Binding Review, Mode=TwoWay}" HorizontalAlignment="Left" Height="72" TextWrapping="Wrap" VerticalAlignment="Top" Width="316" Margin="154,159,0,0" Grid.Row="1"/>
<TextBox Text="{Binding Rating, Mode=TwoWay}" HorizontalAlignment="Left" Height="72" TextWrapping="Wrap" VerticalAlignment="Top" Width="316" Margin="154,231,0,0" Grid.Row="1"/>
it does not display anything i know that it is wrong and that is why i am here is there anyway that you can show me a working example as i am very new to window phone and online is really hard to find. I am doing this for a school project and will not earn money please help i am doing it to pass school.