sql-server-2005

Code to Convert Excel to PDF using VB.NET

拟墨画扇 提交于 2019-12-13 06:17:15
问题 I have VB code to convert .xlsx to .pdf in SCRIPT TASK. When I run the task its running successfully without any erros. But the Excel file is not converting to pdf format. I have added Microsoft.Office.Interop.Excel reference to the task. Please look into the below code. I could not know what is the error in this. Please help. Thanks in advance. Imports Excel = Microsoft.Office.Interop.Excel Imports System.IO Imports System.Data.SqlClient Imports System.Text Imports Microsoft.Office.Interop

How to host site with ASPNETDB.MDF database from Development Server to Production Server?

梦想与她 提交于 2019-12-13 05:49:14
问题 I have created my site using ASP.NET Personal Starter Kits 3.5. I use Visual Studio 2008 only . .with its built-in SQL Server (2005 Express) ... my database in App_Data is ASPNETDB.MDF ... I have created some of my tables also ....in ASPNETDB .. In my local PC the site was running fine ... But when I publish my site on production server it doesn't work and shows the following error <!-- Web.Config Configuration File --> <configuration> <system.web> <customErrors mode="Off"/> </system.web> <

Counting spaces before and after a decimal point

二次信任 提交于 2019-12-13 05:36:59
问题 I have data set as a varchar(500), but I only know if it's numeric or character. I need to count the max spaces of the length of a column AND the max spaces after a decimal point. For Example: ColumnA 1234.56789 123.4567890 would return 11 spaces total AND 7 spaces after the decimal. It can be two separate queries. 回答1: SELECT LEN(ColumnA ) ,CHARINDEX('.',REVERSE(ColumnA ))-1 FROM Table1 If a value has no decimal, the above will return -1 for the spaces after decimal, so you could use: SELECT

SQL Developer: Joining tables from connected SQL Server DB and connected Oracle DB

江枫思渺然 提交于 2019-12-13 05:23:37
问题 We are migrating from SQL Server 2005 to Oracle 11G. I have been trying to do an update to a table in Oracle using data stored in a table in SQL Server. Using SQL Developer, I have completed the following: Created a connection to the Oracle Database Created Connection name --> e9_crp Supplied User name and Pass Defined Host Name and SID I also created a connection to the SQL Server that contains the reference data Connection Name --> sql_data User Name and Pass Host and Port The connection

Conditional WHERE clause for fetching records

爷,独闯天下 提交于 2019-12-13 05:23:11
问题 I am using SQL Server 2008 R2. I am having an SQL block as below : DECLARE @Day INT = 5 DECLARE @Month INT = NULL DECLARE @year INT = NULL DECLARE @dtnow DATETIME SET @dtnow = GETDATE() IF @Month IS NULL SELECT @Month = MONTH(DATEADD(MONTH,-1, @dtnow )) IF @Year IS NULL SELECT @year = YEAR(DATEADD(MONTH,-1, @dtnow )) SELECT * FROM TblSalesRecords WHERE CASE WHEN @Day IS NULL THEN -- Condition One BEGIN ISNULL(@Month, MONTH(TblSalesRecords.CreatedDate)) = MONTH(TblSalesRecords.CreatedDate) AND

How to create DSN for SQL Server using C#?

删除回忆录丶 提交于 2019-12-13 05:20:25
问题 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using Microsoft.SqlServer.Management.Common; using Microsoft.SqlServer.Management.Smo; using System.Data.SqlClient; using Microsoft.Win32; using System.Runtime.InteropServices; [DllImport("ODBCCP32.dll")] private static extern bool SQLConfigDataSource(IntPtr parent, int request, string driver, string attributes)

using nested if in stored procedure

旧巷老猫 提交于 2019-12-13 05:14:22
问题 I am trying to create a stored procedure using nested if, but I am not getting how to frame it. Please help me out. This if what I am trying to do: CREATE PROCEDURE StarDistributorProfit @sponsorId varchar(20), AS if exists(select sponsor_id where(select count(user_id) from usertransaction where bv=50001)) if count=1,TotalGBV=25000,TotalPBV=200 BEGIN update usertransaction set rank='executive' where sponsor_id=@sponsorId update usertransaction set dp=(0.309*BV) update usertransaction set

What would be a reliable way to get fractional value from a number?

一曲冷凌霜 提交于 2019-12-13 04:45:23
问题 I have a number of type Decimal(8, 2) and have been using Substring to get fractional value. E.g.) declare @val decimal(8, 2), @strVal varchar(10) set @val = 15.80 set @strVal = cast(@val as varchar) select @val, substring(@strVal, charindex('.', @strVal), len(@strVal)) Is there a better way to simply get fractional value, .80 from @val without having to convert it to a character? I am wondering if there is a built-in UDF (User-Defined Function) that would parse instead of having to rolling

How to pass a Dictionary variable to another procedure

烂漫一生 提交于 2019-12-13 04:36:42
问题 I am developing a C# VS2008/SQL Server website application. I've never used the Dictionary class before, but I am trying to replace my Hashtable with a Dictionary variable. Here is a portion of my aspx.cs code: ... Dictionary<string, string> openWith = new Dictionary<string, string>(); for (int col = 0; col < headers.Length; col++) { @temp = (col + 1); @tempS = @temp.ToString(); @tempT = "@col" + @temp.ToString(); ... openWith.Add(@tempT, headers[col]); } ... for (int r = 0; r < myInputFile

SQL Server 2005 Delete Query SLOW

心已入冬 提交于 2019-12-13 04:34:02
问题 I have a Delete Query that each day needs to run deleting any data that is greater than 7 days old which is about 6 Million Records. My table should only store data for the last 7 days. Here is the query I am running: DELETE FROM [tblTSS_DataCollection] Where [DatapointDate] < DATEADD(D, -7, GETDATE()) This query takes 5.5 minutes to execute. I have an index setup that includes this so I don't think it should be taking this long to execute: CREATE UNIQUE NONCLUSTERED INDEX [IX_tblTSS