简体   繁体   English

如何从使用C#通过Internet远程连接的SQL Server中选择所有表?

[英]How to select all the tables from SQL Server is connected remotely via the internet using C #?

I have a question like this! 我有这样的问题!

How to select all the tables from SQL Server is connected remotely via the internet from another machine using C #? 如何从使用C#通过另一台计算机通过Internet远程连接的SQL Server中选择所有表?

If possible, select all the fields in a database table any of that? 如果可能,选择数据库表中的所有字段吗?

//connectionstring will have all your SqlServer name user id and password // connectionstring将具有您所有的SqlServer名称用户名和密码

private static void ReadOrderData(string connectionString)
{
    string queryString =
        "SELECT OrderID, CustomerID FROM dbo.Orders;";

    using (SqlConnection connection =
               new SqlConnection(connectionString))
    {
        SqlCommand command =
            new SqlCommand(queryString, connection);
        connection.Open();

        SqlDataReader reader = command.ExecuteReader();

        // Call Read before accessing data.
        while (reader.Read())
        {
            Console.WriteLine(String.Format("{0}, {1}",
                reader[0], reader[1]));
        }

        // Call Close when done reading.
        reader.Close();
    }
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用C#远程更新SQL Server数据库 - How to update SQL Server database remotely using C# SQL Server,数据网格:从中选择,更新所有表中的字段 - SQL Server, Datagrid(s): Select from, update fields in all tables 如何使用SQL Server身份验证从Web服务远程访问SQL Server命名实例 - How to access SQL Server named instance remotely from web service using SQL Server authentication 使用C#动态将所有表的数据从一个SQL Server数据库插入第二个数据库 - Insert data from one SQL Server database into a second database for all tables dynamically using C# 如何从 C# SQL 服务器中的特定模式中删除所有表? - How to drop all tables from specific schema in C# SQL Server? 无法使用c#远程连接SQL Server 2005 Express - Not able to connect SQL Server 2005 Express using c# remotely 使用C#和SQL Server从数据库中选择与当前时间相同的所有列 - Select all columns from database same as present time using C# and SQL Server SQL Server CE和C#; 使用SQL Server CE DB中的所有表填充数据集 - SQL Server CE and C#; Populate a DataSet with ALL the Tables from a SQL Server CE DB 如何使用NetworksApi.TCP.SERVER将文件发送到C#中连接到服务器的所有客户端 - How to send file to all the clients connected to the server in C# using NetworksApi.TCP.SERVER 如何使用 C# 和 SQL Server 编写代码以从多个表中获取数据 - How to code to get data from multiple tables using C# and SQL Server
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM