我用它的數據庫從網上下載了一個項目。我運行該項目,並添加它的數據庫服務器選項卡上的VS 2008 SP1和具有SQL Server 2008c連接字符串錯誤數據庫#
但是,當我一個新的連接字符串複製到程序中,我得到了以下錯誤消息:
無法識別的轉義序列
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;
namespace AzmongirSource
{
class cl
{
static public string idstudent;
static public string userteacher;
static public string nameazmon;
static public string codeazmon;
static public string azmon_typ;
static public string azmon_for_test_type;
static public string time_limit;
static public string tedade_soalat;
static public SqlConnection connection = new SqlConnection();
static public SqlCommand command = new SqlCommand();
static public SqlDataReader reader;
static public int truequestion = 0, falsequestion = 0, noquestion = 0;
static public void creatconnection()
{
connection.Close();
connection.ConnectionString = "Data Source=WINXPX86-BE;AttachDbFilename=D:\payegah\azmoongir_data.MDF;Integrated Security=True";
connection.Open();
command.Connection = connection;
}
static public DataTable StudentList()
{
creatconnection();
string query = "Select idstu as[شماره دانشجویی],namestu as [نام],familystu as [نام خانوادگی],standardcode as [کداستاندارد],reshte as [رشته] from tbl_student";
SqlDataAdapter da = new SqlDataAdapter(query, cl.connection);
DataTable dtt = new DataTable();
da.Fill(dtt);
connection.Close();
return dtt;
}
}
}