如何创造&在C#.net中使用sql的sql过程 [英] how to create & use the sql procedure of sql in C#.net

查看:54
本文介绍了如何创造&在C#.net中使用sql的sql过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

PLs帮助..



如何在C#.net上创建和使用sql的sql程序按钮点击

PLs help..

how to create & use the sql procedure of sql in C#.net on Button click

推荐答案

您好,



请参阅以下链接了解您的解决方案。



< a href =http://stackoverflow.com/questions/169330/simple-way-to-programmatically-get-all-stored-procedures>以编程方式获取所有存储过程的简单方法

使用c#CLR项目存储过程

用C#创建存储过程



谢谢
Hi,

Refer the following links for your solutions.

Simple way to programmatically get all stored procedures
Stored Procedure Using c# CLR Project
Creating Stored Procedures in C#

Thanks


尝试:
using (SqlConnection con = new SqlConnection(strConnect))
    {
    con.Open();
    using (SqlCommand com = new SqlCommand("SELECT iD, description FROM myTable", con))
        {
        using (SqlDataReader reader = com.ExecuteReader())
            {
            while (reader.Read())
                {
                int id = (int) reader["iD"];
                string desc = (string) reader["description"];
                Console.WriteLine("ID: {0}\n    {1}", iD, desc);
                }
            }
        }
    }


这篇关于如何创造&amp;在C#.net中使用sql的sql过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆