Just I'm Trying to insert a data From C# Windows Forms Application User control to My firebase. I have Install Nuget Package "FirebaseDatabase.net". I have checked AuthSecret and BasePath is correct, but why response i null. Im any thing missing ? Please Help Me don't Close this Question.
I'm Followed this https://www.youtube.com/watch?v=jZMwwZHJXJc
using FireSharp.Config;
using FireSharp.Response;
using FireSharp.Interfaces;
IFirebaseConfig Config = new FirebaseConfig
{
AuthSecret = "xyz",
BasePath = "https://xyz-56633a.firebaseio.com"
};
IFirebaseClient Client;
Client = new FireSharp.FirebaseClient(Config);
if (Client!= null)
{
MessageBox.Show("Connected");
}
else
{
MessageBox.Show("Error Connection");
}
private async void Button1_Click(object sender, EventArgs e)
{
var data = new Data()
{
id = textBox1.Text,
Name1 = textBox2.Text,
Name2 = textBox3.Text,
Name3 = textBox4.Text,
Name4 = textBox5.Text,
};
SetResponse response = await Client.SetTaskAsync("NewList/" + textBox1.Text,data);
Data result = response.ResultAs<Data>();
MessageBox.Show("Data Inserted" + result);
}
}
While the above Code runing
MessageBox.Show("Connected");
is Working. But
Data result= response.ResultAs<Data>();
Show Error As System.NullReferenceException: 'Object reference not set to an instance of an object.' And the Data is not inserted. Please Help me to Fix this or If any other way available forward to me