|
You last visited: Today at 02:59
Advertisement
Someone can Help me fix this code Update Link SqlServer using C#
Discussion on Someone can Help me fix this code Update Link SqlServer using C# within the .NET Languages forum part of the Coders Den category.
10/24/2019, 19:19
|
#1
|
elite*gold: 0
Join Date: May 2019
Posts: 23
Received Thanks: 4
|
Someone can Help me fix this code Update Link SqlServer using C#
namespace UpdateMaster
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
SqlConnection conn = new SqlConnection("Data Source=127.0.0.1;Initial Catalog=master;User Id=sa;Password=123456");
private void button1_Click(object sender, EventArgs e)
{
string SqlQuery = string.Format("UPDATE EXEC sp_addlinkedserver 'GHBILL','','MSDASQL',NULL,NULL,'DRIVER={SQL Server};SERVER=localhost;UID=;PWD=;'", conn);
SqlDataAdapter Adpter = new SqlDataAdapter(SqlQuery, conn);
Adpter.SelectCommand.ExecuteNonQuery();
conn.Close();
MessageBox.Show("Update SuccessFully!!!");
}
}
}
|
|
|
10/25/2019, 12:48
|
#2
|
elite*gold: 0
Join Date: Aug 2010
Posts: 880
Received Thanks: 113
|
PHP Code:
private MySqlConnection _connection;
private MySqlCommand _command;
private readonly string _connectionString = $"SERVER={Server};DATABASE={Database};UID={Username};PASSWORD={Password};SSL Mode=None";
public async void Update(string query, Dictionary<string, dynamic> parameters = null)
{
Console.WriteLine("Connection state: " + _connection.State);
if (_connection.State != ConnectionState.Open)
{
await _connection.OpenAsync();
}
_command = new MySqlCommand(query, _connection);
if (parameters != null)
{
foreach (var param in parameters)
{
_command.Parameters.AddWithValue(param.Key, param.Value);
}
}
await _command.ExecuteNonQueryAsync();
}
|
|
|
 |
Similar Threads
|
how i can connect c# for update Master SQLSERVER
10/12/2020 - .NET Languages - 3 Replies
Someone can help me how i can connect c# for update Master SQLSERVER
I'm trying but no sucess someone can help me how i can fix this code for update Master Query Azanalizer Sql Server.
I make this code for he update on this sp_addlinkedserver
EXEC sp_addlinkedserver 'Server','','MSDASQL',NULL,NULL,'DRIVER={SQL Server};SERVER=localhost;UID=;PWD=;'
|
[Problem] =D withe SqlServer
11/19/2012 - Rappelz Private Server - 5 Replies
Hi ,
when i delete This code--("910005 ")-- from Telecaster
jus this ("910005 ")
i Find this error -_-"
Msg 8646, Level 21, State 1, Line 4 Unable to find index entry in index ID 4, of table 1366295927, in database 'Telecaster'. The indicated index is corrupt or there is a problem with the current update plan. Run DBCC CHECKDB or DBCC CHECKTABLE. If the problem persists, contact product support. Msg 0, Level 20, State 0, Line 0 A severe error occurred on the current command. The...
|
SQLServer erstellt keine Datenbanken mehr ..
05/02/2012 - Flyff Private Server - 3 Replies
Hallo,
ich habe das Problem, dass Microsoft SQLServer keine Datenbanken mehr erstellt. Ich hatte vor längerer Zeit mal eine Flyff-Datenbank laufen,
von dort müssen scheinbar, trotz (mehrfacher) Deinstallation und Neuinstallation, noch Daten oder komplette Datenbanken vorhanden sein, denn wenn ich die AiO-Datenbank von Sedrika
ausführe meint das Programm: "In der Datenbank ist bereits ein Objekt mit dem Namen 'ACCOUNT_TBL' vorhanden." (nur als Beispiel, gilt auch für die anderen Daten) -...
|
[Help]I have a problem with SQLServer 2008 R2/J'ai un probléme avec SQLServer 2008 R2
03/01/2012 - Rappelz Private Server - 8 Replies
Hi !
I have a problem when I install SQL Server 2008 R2.
___________________________________________
Bonjour !
J'ai un problème lors de l’installation de SQL Server 2008 R2.
Here is a screenshot / Voici un screenshot :
|
All times are GMT +1. The time now is 03:00.
|
|