日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

计算机目录读取,从项目目录中读取SQL查询文件(Read SQL query file from project directory)...

發(fā)布時(shí)間:2025/3/21 数据库 50 豆豆
生活随笔 收集整理的這篇文章主要介紹了 计算机目录读取,从项目目录中读取SQL查询文件(Read SQL query file from project directory)... 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

從項(xiàng)目目錄中讀取SQL查詢文件(Read SQL query file from project directory)

我在Visual Studio項(xiàng)目中放置了3個(gè)特別大的SQL查詢,位于項(xiàng)目目錄中的“查詢”文件夾下(不是解決方案)。 有沒有一種雄辯的方式來訪問這些文件? 我希望像@"Queries/firstSqlQuery.sql這樣的東西可行。

指定完整路徑,比如@"C:\\Users\John\Documents\VisualStudio2010\Projects\MySolution\MyProject\Queries\firstSqlQuery.sql是我真的不想做的事情,因?yàn)樗枰一氐酱a并修復(fù)路徑,如果應(yīng)用程序移動(dòng)。

編輯:由于某種原因,該頁面正在C:\\Program Files(x86)\Common Files\Microsoft Shared\DevServer\Queries\firstSqlQuery.sql 。 當(dāng)可執(zhí)行文件目錄不同時(shí),為什么要查看此位置?

I've put 3 especially large SQL queries within my Visual Studio project, under a folder "Queries" that is in the project directory (not the solution). Is there an eloquent way to access these files? I was hoping that something like @"Queries/firstSqlQuery.sql would work.

Specifying the full path, like with @"C:\\Users\John\Documents\VisualStudio2010\Projects\MySolution\MyProject\Queries\firstSqlQuery.sql is something I'd really rather not do, since it requires me to go back into code and fix the path, should the application move.

EDIT: For some reason, the page is looking for the files in C:\\Program Files(x86)\Common Files\Microsoft Shared\DevServer\Queries\firstSqlQuery.sql. Why is it looking in this location, when the executable directory is different?

原文:https://stackoverflow.com/questions/16984269

2019-11-29 16:11

滿意答案

你可以做這樣的事情......如果它在項(xiàng)目之外。 (當(dāng)我初讀這篇文章時(shí) - 我誤讀并認(rèn)為它在我假設(shè)包含該項(xiàng)目的解決方案目錄中) -

var pathToBin = Assembly.GetExecutingAssembly().Location;

var directoryInfoOfBin = new DirectoryInfo(pathToBin);

var solutionDirectory = directory.Parent().Parent();

var pathToSolution = solutionDirectory.FullName;

但如果它在項(xiàng)目中,這會(huì)簡單得多

System.Web.HttpContext.Current.Server.MapPath("~/Queries/firstSqlQuery");

You can do something like this... if it's outside of project. (When I intitially read this-- I misread and thought it was in the solution directory which I was assuming contained the project)--

var pathToBin = Assembly.GetExecutingAssembly().Location;

var directoryInfoOfBin = new DirectoryInfo(pathToBin);

var solutionDirectory = directory.Parent().Parent();

var pathToSolution = solutionDirectory.FullName;

but this is much simpler if it's in the project

System.Web.HttpContext.Current.Server.MapPath("~/Queries/firstSqlQuery");

相關(guān)問答

從解決方案資源管理器中,右鍵單擊myfile.txt并選擇“屬性” 從那里,將Build Action設(shè)置為content并Copy to Output Directory以使其Copy always Copy if newer或Copy if newer From Solution Explorer, right click on myfile.txt and choose "Properties" From there, set the Build Action to content and ...

請(qǐng)參閱: 支持的.NET Framework庫 仍然可以從托管存儲(chǔ)過程,觸發(fā)器,用戶定義函數(shù),用戶定義類型和用戶定義聚合中調(diào)用不受支持的庫。 必須首先使用CREATE ASSEMBLY語句在SQL Server數(shù)據(jù)庫中注冊(cè)不受支持的庫,然后才能在代碼中使用它。 應(yīng)檢查并測(cè)試在服務(wù)器上注冊(cè)和運(yùn)行的任何不受支持的庫的安全性和可靠性。 例如,不支持System.DirectoryServices命名空間。 您必須先注冊(cè)具有UNSAFE權(quán)限的System.DirectoryServices.dll程序集,...

你問題中的圖像不是一個(gè)項(xiàng)目。 它是SSMS對(duì)象資源管理器,是您連接到的數(shù)據(jù)庫服務(wù)器上對(duì)象的分層視圖。 SSMS項(xiàng)目的默認(rèn)位置是C:\Users\\Documents\SQL Server Management Studio 。 The image in your question is not a project. It is SSMS Object Explorer, a hierarchical view of objects on the database server...

嘗試使用動(dòng)態(tài)SQL,因?yàn)槟贠PENROWSET中使用參數(shù) DECLARE @i int = 1

DECLARE @file AS nvarchar(MAX)

DECLARE @sql VARCHAR(max)

WHILE(@i<=50)

BEGIN

SET @file = 'C:\Users\Barry\Desktop\Output\output' + cast(@i as varchar(2)) + '.txt';

SET @sql = '

INSERT INTO dbo.[...

CLR存儲(chǔ)過程最適合這樣的任務(wù)。 MSDN : 創(chuàng)建CLR存儲(chǔ)過程 。 如何 創(chuàng)建和運(yùn)行CLR SQL Server存儲(chǔ)過程 也看到這個(gè)SO答案 ,有一些你需要的代碼。 這個(gè)創(chuàng)建一個(gè)CLR函數(shù)(代碼粘貼在下面)。 public partial class UserDefinedFunctions

{

[SqlFunction(DataAccess = DataAccessKind.Read,

FillRowMethodName = "GetFiles_FillRow", T...

編寫一個(gè)CLR storedprocedure(c#),它讀取圖像文件的內(nèi)容并將其作為varbinary(MAX)返回。 Write a CLR storedprocedure (c#) which reads the contents of the image file and returns it as a varbinary(MAX).

你可以做這樣的事情......如果它在項(xiàng)目之外。 (當(dāng)我初讀這篇文章時(shí) - 我誤讀并認(rèn)為它在我假設(shè)包含該項(xiàng)目的解決方案目錄中) - var pathToBin = Assembly.GetExecutingAssembly().Location;

var directoryInfoOfBin = new DirectoryInfo(pathToBin);

var solutionDirectory = directory.Parent().Parent();

var pathToSolution ...

您可能想要嘗試的是使用: AssetManager am = getAssets();

InputStream is;

is = am.open(pathToFile.txt);

然后使用byte []緩沖區(qū)(使用is.available();獲取大小)和is.read(緩沖區(qū))讀取后不要忘記is.close()。 如果您不在Activity中,則必須使用context.getAssets()才能獲取AssetManager。 希望對(duì)你有所幫助。 What you might want to t...

我們首先開始調(diào)試文件路徑問題。 你可以在這里使用兩件事。 function db_data() {

WP_Filesystem();

global $wp_filesystem;

global $wpdb;

echo 'Current Path is '. __DIR__;

$file = __DIR__."/sql/my_insert_query.sql";

if(!is_readable($file)) {

echo 'File...

如果你使用this.class().getClassLoader().getResourceAsStream("/res/xxx") ,它將嘗試從類路徑加載資源。 如果您不希望這樣做,則需要指定絕對(duì)路徑。 Classpath上的資源 如果您不希望將資源內(nèi)置到JAR中,我建議在src/main/resources目錄下使用不同的maven項(xiàng)目。 這將創(chuàng)建一個(gè)包含文件的jar文件,大小約為500MB。 在此之后,您可以在包含應(yīng)用程序代碼的項(xiàng)目中包含此項(xiàng)目的依賴項(xiàng)。 然后,這將能夠使用getResour...

相關(guān)文章

出現(xiàn)bad interpreter:No such file or directory的原因 是文件格

...

Hi Pythonistas! 測(cè)試和調(diào)試 Testing & Debuggi

...

這個(gè)是因?yàn)楸镜貨]有安裝php-solr的擴(kuò)展導(dǎo)致的,安裝方法(使用的是ubuntu) cd /opt

...

查詢一個(gè)對(duì)象(實(shí)體類必須有一個(gè)不帶參數(shù)的構(gòu)造方法),使用select查詢,基于投影的查詢,通過在列表中

...

用source c:\xxx.sql,出現(xiàn)Ignoring query to other databa

...

Java 流(Stream)、文件(File)和IO Java.io包幾乎包含了所有操作輸入、輸

...

有表格如下: t_table 8 想得到這樣的結(jié)果:(只取有重復(fù)的第一個(gè),相同的排除,例如f) 1 a

...

數(shù)據(jù)庫表A 有個(gè)字段a是int類型 a中有數(shù)據(jù)有1到9任意(有重復(fù)的) 想取得a中,當(dāng) a=1時(shí)

...

Solr1.4 Both delete by id and delete by query can b

...

查詢操作符(Query Operators)可以讓我們寫出復(fù)雜查詢條件,讓我們使用的過程更加靈活。官方

...

最新問答

找到了完全相同的東西: http : //www.dragonbyte-tech.com/product/40-vbcredits-ii-deluxe/ Found something that does exact same thing: http://www.dragonbyte-tech.com/product/40-vbcredits-ii-deluxe/

不知道任何可以實(shí)際切換的調(diào)試器,但您可以將兩個(gè)調(diào)試器連接到您的進(jìn)程。 在調(diào)試模式下在Java IDE中啟動(dòng)Java程序會(huì)附加Java調(diào)試器。 然后打開用于CPP代碼的IDE,并將其調(diào)試器附加到正在運(yùn)行的Java進(jìn)程。 在Visual Studio中,這將是Debug -> Attach to Process... 您將看到一個(gè)包含進(jìn)程列表的對(duì)話框。 在這里選擇您的Java進(jìn)程。 如果Visual Studio無法正確檢測(cè)到,您可能必須將列表上方的字段切換為“本機(jī)代碼”。 在CPP代碼中設(shè)置適當(dāng)?shù)?/p>

您需要使用ajax發(fā)送該變量。 $.get('your.jsp', {data: $('#'+this.id+'t').val()}, function(response) { console.log(response); }); You need to send that variable using ajax. $.get('your.jsp', {data: $('#'+this.id+'t').val()}, function(response) { console.l

確保已設(shè)置root密碼(sudo su passwd)根據(jù)ssh的安裝方式,通常需要編輯/ etc / ssh / sshd_config并將“PermitRootLogin no”更改為“PermitRootLogin yes” Make sure you have set a root password (sudo su passwd) Depending how your ssh is installed, you usually need to edit /etc/ssh/sshd_co

看看FMDB的用法 。 [db executeUpdate:@"INSERT INTO notes VALUES (?,?,?)", title, comment, [NSNumber numberWithInt:fkID]]; 提供給-executeUpdate:方法的所有參數(shù)(或接受va_list作為參數(shù)的任何變體)都必須是對(duì)象。 Here is what I ended up doing. NSString *sql = [NSString stringWithFormat:

我后來發(fā)現(xiàn)這是一個(gè)與多德興相關(guān)的問題。 我需要運(yùn)行一個(gè)腳本來為我的main-dex-list生成文件的名稱 下面的博客文章詳細(xì)介紹了這一點(diǎn): http : //blog.osom.info/2014/10/generating-main-dex-list-file.html I later found out that this was an issue relating to multi dexing. I needed to run a script to generate the name

使用OAuth 2.0,您可以使用可擴(kuò)展的標(biāo)準(zhǔn)和基于令牌的身份驗(yàn)證,使用戶可以撤消身份驗(yàn)證票證,例如,如果他們的手機(jī)被盜。 OAuth 2.0支持各種授權(quán)類型。 那些來自facebook和twitter登錄的人可以概括為“3-legged oauth”,但是對(duì)于2-legged OAuth,還有兩種授權(quán)類型,特別是資源所有者密碼憑證授權(quán) (頁面末尾的第4.3節(jié)),這將是只需交換身份驗(yàn)證令牌的用戶名和密碼即可。 如果你不愿意,就沒有必要實(shí)施三條腿的oauth。 對(duì)于大多數(shù)用例,我建議在基于加密的自

您應(yīng)該將此作為多個(gè)連接進(jìn)行處理。 特別是,您需要為電子郵件的“從”和“到”部分單獨(dú)加入: SELECT e.EmailID as id, e.DateStamp as timed, edfrom.profileid as sender, edto.profileid as receiver FROM EmailDirection edfrom join Email e on edfrom.emailid = e.emailid and ed.direction

問題根本不是ngZone 。 事實(shí)上,您正在使用更改this值的常規(guī)函數(shù)。 所以this.distance內(nèi)的this.distance距離function(response,status)是不同的。 嘗試: (response, status)=> { if (status === 'OK') { directionsDisplay.setDirections(response); var total = 0; var rou

總結(jié)

以上是生活随笔為你收集整理的计算机目录读取,从项目目录中读取SQL查询文件(Read SQL query file from project directory)...的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。