hello guys i get stuck so badly
i created a windows form with sql express with visual studio 2017 .
the application work nicely in my own pc but when i published it and instal it another pc , i get error a network related error 52.
consider it that i have installed sql express on clinet pc.
this link to my project
Hamkar_Vendors - Download - 4shared[
^]
this my code
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Hamkar_Vendors
{
public partial class MainForm : Form
{
string con_string = @"Data Source=.\SQLEXPRESS2014;Initial Catalog=hamkar_Vendor1;Integrated Security=True";
SqlDataAdapter dataAdapter;
DataTable dataTable;
public MainForm()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
vendorGrp.Hide();
Getdata("select * from vendor");
}
private void Getdata(string selectedString)
{
try {
dataAdapter = new SqlDataAdapter(selectedString,con_string );
dataTable = new DataTable();
dataTable.Locale = System.Globalization.CultureInfo.InvariantCulture;
dataAdapter.Fill(dataTable);
bindingSource1.DataSource = dataTable;
}
catch(Exception e)
{
MessageBox.Show(e.Message);
}
}
private void ثبتاطلاعاتToolStripMenuItem_Click(object sender, EventArgs e)
{
vendorGrp.Show();
}
private void خروجToolStripMenuItem_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void submitBtn_Click(object sender, EventArgs e)
{
SqlCommand command;
string insert = @"insert into vendor(Address , Company_Name , Country , Email , Fax , Industry , Phone , Resume , ResumeWithUs , TypeOfItems , TypeOfServices , WebSite)
values (@Address , @Company_Name , @Country , @Email , @Fax , @Industry , @Phone , @Resume , @ResumeWithUs , @TypeOfItems , @TypeOfServices , @WebSite) ";
using (SqlConnection con = new SqlConnection(con_string))
{
try
{
con.Open();
command = new SqlCommand(insert, con);
command.Parameters.AddWithValue(@"Address", AddressTxt.Text);
command.Parameters.AddWithValue(@"Company_Name", CompanyTxt.Text);
command.Parameters.AddWithValue(@"Country", CompanyTxt.Text);
command.Parameters.AddWithValue(@"Email", EmailTxt.Text);
command.Parameters.AddWithValue(@"Fax", FaxTxt.Text);
command.Parameters.AddWithValue(@"Industry", IndustryTxt.Text);
command.Parameters.AddWithValue(@"Phone", TelephoneTxt.Text);
command.Parameters.AddWithValue(@"Resume",Resumetxt.Text );
command.Parameters.AddWithValue(@"ResumeWithUs", ResumeWustxt.Text);
command.Parameters.AddWithValue(@"TypeOfItems", ItemsTxt.Text);
command.Parameters.AddWithValue(@"TypeOfServices", servicetxt.Text);
command.Parameters.AddWithValue(@"WebSite", WebSiteTxt.Text);
command.ExecuteNonQuery();
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
Getdata("select * from vendor");
dataGridView1.Update();
}
}
private void vendorGrp_Enter(object sender, EventArgs e)
{
dataGridView1.DataSource = bindingSource1;
}
private void menuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
{
}
private void toolStripMenuItem1_Click(object sender, EventArgs e)
{
}
private void جستجویاطلاعاتToolStripMenuItem1_Click(object sender, EventArgs e)
{
}
private void DeleteBtn_Click(object sender, EventArgs e)
{
DataGridViewRow row = dataGridView1.CurrentCell.OwningRow;
string value = row.Cells["id"].Value.ToString();
string cname = row.Cells["Company_Name"].Value.ToString();
string address = row.Cells["Address"].Value.ToString();
DialogResult dialogresualt = MessageBox.Show("آیا از حذف رکورد مطمئن هستید","پیغام", MessageBoxButtons.YesNo,MessageBoxIcon.Question);
string DeleteStatment = "Delete from vendor where id = '" + value + "'";
if(dialogresualt == DialogResult.Yes)
{
using (SqlConnection con = new SqlConnection(con_string))
{
try
{
con.Open();
SqlCommand com = new SqlCommand(DeleteStatment, con);
com.ExecuteNonQuery();
Getdata("select * from vendor");
dataGridView1.Update();
}
catch(Exception ed)
{
MessageBox.Show(ed.Message);
}
}
}
}
private void SearchBtn_Click(object sender, EventArgs e)
{
switch(searchcombo.SelectedItem.ToString())
{
case "نام شرکت":
Getdata("select * from vendor where lower(Company_Name) like '%" + searchtxt.Text.ToLower() + "%'");
break;
case "تلفن":
Getdata("select * from vendor where lower(Phone) like '%" + searchtxt.Text.ToLower() + "%'");
break;
case "ایمیل":
Getdata("select * from vendor where lower(Email) like '%" + searchtxt.Text.ToLower() + "%'");
break;
case "فکس":
Getdata("select * from vendor where lower(Fax) like '%" + searchtxt.Text.ToLower() + "%'");
break;
case "وب سایت":
Getdata("select * from vendor where lower(WebSite) like '%" + searchtxt.Text.ToLower() + "%'");
break;
case "زمینه فعالیت":
Getdata("select * from vendor where lower(TypeOfService) like '%" + searchtxt.Text.ToLower() + "%'");
break;
case "صنعت":
Getdata("select * from vendor where lower(Industry) like '%" + searchtxt.Text.ToLower() + "%'");
break;
case "محصولات":
Getdata("select * from vendor where lower(TypeOfItems) like '%" + searchtxt.Text.ToLower() + "%'");
break;
}
}
}
}
What I have tried:
i tried almost everything
like enabling all the sql server express services on client pc