End Google Ads 201810 - BS.net 01 -->
Hi,
I try to develop a csharp smart device application.I want to try the RDA method to connect to the database .mdf located in my collegue'sPC.
My code is like that:
using System;
using System.Linq;
using System.Data.SqlServerCe;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace ModeDifféré
{
public partial class Form6 : Form
{
public Form6()
{
InitializeComponent();
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void Form6_Load(object sender, EventArgs e)
{
string sConnection = "Data Source=Bacem-PC;User ID=sa;Password=sa;Initial Catalog=GMAO;Persist Security Info=false;";
string sSQL = "SELECT Nbt FROM 4BT; ";
SqlConnection conn = new SqlConnection(sConnection);
SqlCommand comm = new SqlCommand(sSQL, conn);
SqlDataReader dr = null;
try
{
comm.Connection.Open();
dr = comm.ExecuteReader();
while (dr.Read())
comboBox1.Items.Add(dr[0]);
}
catch (SqlException ex)
{
MessageBox.Show("connexion impossible");
MessageBox.Show(ex.Message);
return;
}
dr.Close();
comm.Connection.Close();
}
}
}
where bacem-PC is my freind'sPC server .He enables remote connexion to his sql server.
When running,this error appears:"specified sql server not found or acces denied"
As a note,this is the same arror that appears when I try locally in my PC
I am really fed up of this annoying error??
URGENT HELP I NEED or i will be a mad person
Thanks
مواقع النشر (المفضلة)