J
JTOne
Кто знает как реализовать подключение к ADO в C#,
если есть примерчик, буду очень рад.
Спасибо за рание!
если есть примерчик, буду очень рад.
Спасибо за рание!
3 марта 19:00 бесплатный вебинар с куратором курса
Пентест инфраструктуры Active Directory
>>> Подробнее <<<
protected static string ConnectionString
{
get
{
return "Integrated Security=SSPI;Initial Catalog=bugs;Data Source=localhost;Workstation ID=localhost;";
}
}
protected static SqlConnection Connection
{
get
{
return new SqlConnection(ConnectionString);
}
}
public byte[] View()
{
SqlConnection con = Connection;
SqlCommand cmd = new SqlCommand(
"SELECT * FROM Images",
con);
con.Open();
Bitmap image = null;
byte[] cn = null;
SqlDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
byte[] content = (byte[])reader[0];
cn = content;
MemoryStream stream = new MemoryStream(content);
image = new Bitmap(stream);
........
Перетащи просто из проводника свой .mdf в Solution Exploer на проект и все.не как не могу сделять connecting to SQL SERVER 2005 from Visual C# (ДБ я создал в Microsoft Visual C# 2005 Express Edition)
я использую следушие команды
SqlConnection conn = new SqlConnection("Data Source=(local); Initial Catalog = PRO; integrated Security = true");
conn.Open();
и выдается сообшение
"An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)"
если поможите буду искренее блогодарен
using(SqlConnection conn = new SqlConnection("Data Source=.\SQLEXPRESS; Initial Catalog = PRO; integrated Security = true")
{
conn.Open();
...
}
<connectionStrings>
<add name="LocalSqlServer" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient" />
</connectionStrings>
А кто протокол отключал?А чем .mdf в Solution Explorer решит проблему коннекта (отключенного протокола) к SQL Server?
Обучение наступательной кибербезопасности в игровой форме. Начать игру!