小编use*_*596的帖子

c#执行大型SQL语句

我有一个大的SQL语句,我想在c#中运行,但是,我看到的所有示例都是针对长度为一行的SQL语句.

到目前为止,这是我的C#代码.在我的代码之后,我已经包含了Query,我想要运行.


C#查询代码

private void button4_Click(object sender, EventArgs e)
        {
           System.Data.Odbc.OdbcConnection conn = new System.Data.Odbc.OdbcConnection();
           conn.ConnectionString = "Driver={Oracle in OraClient11g_home1};" +
                                   "Dbq=" + "database" +
                                   ";Uid=" + "admin" + ";Pwd=" + "admin" + ";";
           try
           {
               conn.Open();
               OdbcCommand com = new OdbcCommand("select count(*) from user_tables;", conn);
               com.CommandType = CommandType.Text;
               OdbcDataReader rdr = com.ExecuteReader();
               while (rdr.Read())
               {
                   var mystring = rdr.GetString(0);
                   MessageBox.Show(mystring);
               }                
           }
           catch (Exception ex)
           {
               MessageBox.Show(ex.Message); 
           }
           conn.Close();
        }
Run Code Online (Sandbox Code Playgroud)


查询运行

SELECT user_id,
         user_name,
         user_name_full,
         (SELECT user_name
            FROM MD_SITE_USER …
Run Code Online (Sandbox Code Playgroud)

c# sql oracle

0
推荐指数
2
解决办法
1928
查看次数

JSON到JavaScript字符串

我已经看过很多关于如何将Javascript字符串转换为JSON的帖子,但没有任何关于如何将JSON对象转换为javascript字符串的帖子.

下面的代码片段在javascript控制台上显示时会返回正确的值,但是,当我尝试对JSON.element进行字符串比较时,它会失败.

这是URL请求返回的JSON.

{
  "id": "1e003033",
  "name": "camera",
  "last_app": null,
  "last_ip_address": "192.168.0.27",
  "last_heard": "2016-08-27T14:22:49.762Z",
  "product_id": 6,
  "connected": true,
  "platform_id": 6,
  "cellular": false,
  "status": "normal",
  "pinned_build_target": "0.5.2",
  "variables": {
    "lonlat": "string",
    "speedmph": "string",
    "sats": "string"
  },
  "functions": []
}
Run Code Online (Sandbox Code Playgroud)

这是代码片段:

       requestURL_O = "https://api.spark.io/v1/devices/" + deviceID + "/?access_token=" + accessToken;
       $.getJSON(requestURL_O, function(jonline){
                   console.log(jonline.connected);
                   jstr = jonline.connected;
                   dt_str = jonline.last_heard;
                   console.log(jstr);
                   if (jstr == "true"){
                     online_status = true;
                     console.log("equal = TRUE");
                   }
                   else { 
                    online_status = false;
                    jstr = jonline.last_heard;
                    console.log(jonline.last_heard);
                    console.log("equal = …
Run Code Online (Sandbox Code Playgroud)

javascript string json

-1
推荐指数
1
解决办法
89
查看次数

标签 统计

c# ×1

javascript ×1

json ×1

oracle ×1

sql ×1

string ×1