1

I am working on a project where I'm using SQL for local database, .NET for UI design and C# for coding. I'm supposed to map the locations mentioned in the database on google map. But as I run the application, server connection is getting closed automatically an error 40 is being raised. I have set firewall to allow the SQL server, set TCP/IP port to 1433, restarted the services still facing the same error.

Besides I'm not familiar with .net and C#. I am not able to code the SAVE button in database form. And as I have records more than 2000, it is not possible for me to insert the data manually. I have found 1 code regarding this. Can anyone tell me what to do changes in that?

private void btnSave_Click(object sender, EventArgs e)
    {
        SqlConnection con = new SqlConnection("Integrated security=true;Initial Catalog=Final_Table;Data source=.");
        SqlCommand cmd;
        con.Open();
        string s = "insert into Final_Table values(@p1,@p2,@p3,@p4)";
        cmd = new SqlCommand(s, con);
        cmd.Parameters.AddWithValue("@p1",txtLoc.Text);
        cmd.Parameters.AddWithValue("@p2", txtAsset.Text);
        cmd.Parameters.AddWithValue("@p3", txtLongi.Text);
        cmd.Parameters.AddWithValue("@p4", txtLati.Text);
        cmd.CommandType = CommandType.Text;
        int i = cmd.ExecuteNonQuery();
        con.Close();
        MessageBox.Show("Saved successfully!");
    }

How to link this database to google map using form2. I have MAP button in that form, how can I do that?

halfer
  • 19,824
  • 17
  • 99
  • 186
Rituja Nashikkar
  • 71
  • 1
  • 1
  • 7

0 Answers0