第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會有你想問的

為什么不輸出數(shù)據(jù)呢?

為什么不輸出數(shù)據(jù)呢?

安小圈 2019-01-13 13:40:00
程序沒有報(bào)錯(cuò),數(shù)據(jù)庫中也有數(shù)據(jù),程序運(yùn)行后就直接關(guān)閉了,為什么不輸出數(shù)據(jù)呢?using System;using System.Data;using System.Data.SqlClient;namespace ConsoleApp1{? ? class Program? ? {? ? static void Main(string[] args)? ? ? ? {? ? ? ? ? ? SqlConnection conn = new SqlConnection("server=wdt2019.australiasoutheast.cloudapp.azure.com;uid=s3642823;database=s3642823;pwd=abc123;");? ? ? ? ? ? SqlCommand query = new SqlCommand("select * from dbo.Room", conn);? ? ? ? ? ? SqlDataReader read;? ? ? ? ? ? try? ? ? ? ? ? {? ? ? ? ? ? ? ? conn.Open();? ? ? ? ? ? ? ? read = query.ExecuteReader();? ? ? ? ? ? ? ? while (read.Read())? ? ? ? ? ? ? ? {? ? ? ? ? ? ? ? ? ? Console.WriteLine("{0}",read["RoomID"]);? ? ? ? ? ? ? ? }? ? ? ? ? ? ? ? read.Close();? ? ? ? ? ? }? ? ? ? ? ? catch (SqlException se)? ? ? ? ? ? {? ? ? ? ? ? ? ? Console.WriteLine("SQL Exception: {0}", se.Message);? ? ? ? ? ? }? ? ? ? ? ? catch (Exception e)? ? ? ? ? ? {? ? ? ? ? ? ? ? Console.WriteLine("Exception: {0}", e.Message);? ? ? ? ? ? }? ? ? ? ? ? finally? ? ? ? ? ? {? ? ? ? ? ? ? ? if (conn.State == ConnectionState.Open)? ? ? ? ? ? ? ? {? ? ? ? ? ? ? ? ? ? conn.Close();? ? ? ? ? ? ? ? }? ? ? ? ? ? }? ? ? ? }? ? }}
查看完整描述

1 回答

?
慕函數(shù)5213667

TA貢獻(xiàn)1條經(jīng)驗(yàn) 獲得超0個(gè)贊

猜是顯示了,但是數(shù)據(jù)太少,在read.Close()這里打個(gè)斷點(diǎn)調(diào)試一下

查看完整回答
反對 回復(fù) 2019-01-15
  • 1 回答
  • 0 關(guān)注
  • 989 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號