I am writing the Application in VB to Read the excel. My Excel Contains 6 to 7 sheets in it. But the Sheet name changes frequently. As the application reads the sheet automatically so if I want ot read these sheets irrespective of its name the how is it possible in VB?
I am using the ADO Connection to read the Excel File and thats my recquirement.
Hi, I have an excel spreadsheet with several sheets. These sheets get populated with data from an external source database i.e. a third party application. I would like to create a SSIS package to read the data in each sheet. Please note that I do know how to create SSIS package to read an excel file with only one sheet. Is there a functionality in SSIS to loop though each sheet in one excel file? Thanks
I am working with the ASP.net Personal Website Starter Kit. I have been able to attach the Personal db to my instance of Sql Server Express.
I found out that the database is read only. I tried to run Sql Server as Administrator but that didn't fix this problem. I want to add more files to the database so I can use it when I modify the website.
I am trying to avoid rewriting the db for fear of creating a probem somewhere else in the app. I am new to asp.net and I don't want to complicate things any more than needed at this point.
Is there a way I can make this not read-only? Do I have to rewrite the db?
I'm trying to do Sharepoint DR with Log Shipping and every thing configured except one thing which is switch the WSS_Content (Standby /Read-Only) DB to be ready and Write.
I tried from
GUI or ALTER DATABASE [WSS_Content] SET READ_WRITE WITH NO_WAIT
I have two database files, one .mdf and one .ndf. The creator of these files has marked them readonly. I want to "attach" these files to a new database, but cannot do so because they are read-only. I get this message:
Server: Msg 3415, Level 16, State 2, Line 1 Database 'TestSprintLD2' is read-only or has read-only files and must be made writable before it can be upgraded.
What command(s) are needed to make these files read_write?
OBJECTIVE: I would like to read a text file from SQL Server 2000, read the text file content, and load its conntents in a RichTextBoxTHINGS I'VE DONE AND HAVE WORKING:1) I've successfully load a text file (ex: textFile.txt) in sql server database table column (with datatype Image) 2) I've also able to load the file using a Handler as below: using System;using System.Web;using System.Data.SqlClient;public class HandlerImage : IHttpHandler {string connectionString;public void ProcessRequest (HttpContext context) {connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["NWS_ScheduleSQL2000"].ConnectionString;int ImageID = Convert.ToInt32(context.Request.QueryString["id"]);SqlConnection myConnection = new SqlConnection(connectionString);string Command = "SELECT [Image], Image_Type FROM Images WHERE Image_Id=@Image_Id";SqlCommand cmd = new SqlCommand(Command, myConnection);cmd.Parameters.Add("@Image_Id", System.Data.SqlDbType.Int).Value = ImageID;SqlDataReader dr;myConnection.Open(); cmd.Prepare(); dr = cmd.ExecuteReader();if (dr.Read()){ //WRITE IMAGE TO THE BROWSERcontext.Response.ContentType = dr["Image_Type"].ToString();context.Response.BinaryWrite((byte[])dr["Image"]);}myConnection.Close();}public bool IsReusable {get {return false;}}}'>'> <a href='<%# "HandlerDocument.ashx?id=" + Eval("Doc_ID") %>'>File </a>- Click on this link, I'll be able to download or view the file WHAT I WANT TO DO, BUT HAVE PROBLEM:- I would like to be able to read CONTENT of this file and load it in a string as belowStreamReader SR = new StreamReader()SR = File.Open("File.txt");String contentText = SR.Readline();txtBox.text = contentText;BUT THIS ONLY WORK FOR files in the server.I would like to be able to read FILE CONTENTS from SQL Server.PLEASE HELP. I really appreciate it.
i have a database which get refreshed every day from client's data . and we need to pull heavy data from them every day as reports . so only selects happens on that database.
we do daily population of some table in some other databases from this daily refreshed DB.
will read uncommitted or NOLOCK with select queries to retrieve data faster.
there will be no dirty read as there are NO DML operation in that database so for SELECT which happens concurrently on these tables , will NOLOCK work?
Is it possible to set READ UNCOMMITTED to a user connecting to an SQL2000 server instance? I understand this can be done via a front endapplication. But what I am looking to do is to assign this to aspecific user when they login to the server via any entry application.Can this be set with a trigger?
OK, I'm using VS2003 and I'm having trouble. The page works perfectly when I created it with WebMatrix but I want to learn more about creating code behind pages and this page doesn't work. I think it has some things to do with Query builder but I can't seem to get change outside "please register". I have the table populated and it is not coming back with "login successful" or "password wrong" when I've entered correct information. Enclosed is what I've done in VS2003. Can you see where my error is? Any help would be greatly appreciated. Thanks again.
Imports System.data.sqlclient Imports System.Data Public Class login2 Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer. <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() Me.SqlConnection1 = New System.Data.SqlClient.SqlConnection Me.SqlCommand1 = New System.Data.SqlClient.SqlCommand ' 'SqlConnection1 ' Me.SqlConnection1.ConnectionString = "server=LAWORKSTATION;user id=sa;database=test;password=t3st" ' 'SqlCommand1 ' Me.SqlCommand1.CommandText = "SELECT pass FROM Customer WHERE (email = 'txtusername.text')" Me.SqlCommand1.Connection = Me.SqlConnection1
End Sub Protected WithEvents lblUsername As System.Web.UI.WebControls.Label Protected WithEvents lblPassword As System.Web.UI.WebControls.Label Protected WithEvents txtUsername As System.Web.UI.WebControls.TextBox Protected WithEvents txtPassword As System.Web.UI.WebControls.TextBox Protected WithEvents btnSubmit As System.Web.UI.WebControls.Button Protected WithEvents lblMessage As System.Web.UI.WebControls.Label Protected WithEvents SqlConnection1 As System.Data.SqlClient.SqlConnection Protected WithEvents SqlCommand1 As System.Data.SqlClient.SqlCommand
'NOTE: The following placeholder declaration is required by the Web Form Designer. 'Do not delete or move it. Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init 'CODEGEN: This method call is required by the Web Form Designer 'Do not modify it using the code editor. InitializeComponent() End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Put user code to initialize the page here End Sub
Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click SqlConnection1.Open() Dim dr As SqlDataReader = SqlCommand1.ExecuteReader If dr.Read() Then If dr("password").ToString = txtPassword.Text Then lblMessage.Text = "login successful" Else lblMessage.Text = "Wrong password" End If Else lblMessage.Text = "Please register" End If dr.Close() SqlConnection1.Close() End Sub End Class
I guess nobodys heard of this? I'm using DTS to transform data to Excel spreadsheet. I have a DROP TABLE `data$` then a CREATE TABLE `data$` the old data is cleared but the new data is appended to the blank rows of the old data. So if I had 5 rows before now I have 10. And the new data has 5 blank rows before it.
I've tried deleting the excel file & replacing it with a new one. I've used the wizard thinking it was me but no good, it still happens.
I have a doubt regarding balance sheet calculation in my Software. I am using a stored procedure for these calculations. I have some commands for calculation as given below:
INSERT INTO #Temp (cargo_required, amount_general, amount_ship, amount_shore) SELECT 5000, 1500, 1450, 1490 UNION ALL SELECT 0, 3500, 3500, 3500 UNION ALL SELECT 7000, 4500, 4550, 4560 UNION ALL SELECT 0, 2500, 2000, 2000
DECLARE temp_cursor CURSOR FAST_FORWARD FOR SELECT rec_id, cargo_required, amount_general, amount_ship, amount_shore FROM #Temp
OPEN temp_cursor
FETCH NEXT FROM temp_cursor INTO @tab_id, @car_req, @amt_gen, @amt_shp, @amt_sho
WHILE @@FETCH_STATUS = 0 BEGIN IF (@car_req > 0) BEGIN UPDATE #Temp SET balance_general = @car_req - amount_general ,balance_ship= @car_req - amount_ship ,balance_shore= @car_req - amount_shore WHERE rec_id = @tab_id END ELSE BEGIN UPDATE #Temp SET balance_general = @bal_gen - amount_general ,balance_ship= @bal_shp - amount_ship ,balance_shore= @bal_sho - amount_shore WHERE rec_id = @tab_id END
SELECT @bal_gen = balance_general, @bal_shp = balance_ship, @bal_sho = balance_shore FROM #Temp WHERE rec_id = @tab_id
FETCH NEXT FROM temp_cursor INTO @tab_id, @car_req, @amt_gen, @amt_shp, @amt_sho END
This is what acutally I am having in my stored procedure except the temporary table. The values which I am inserting here will get from my actual tables. What I need is to calculate balance. If you run this script you can see how the balance is calculating using the cursor.
I want an efficient way to calculate the same. I know cursor is not at all good option in stored procedures. Do you have any Idea to make this script in an efficient and simple way?
I have a doubt regarding balance sheet calculation in my Software. I am using a stored procedure for these calculations. I have some commands for calculation as given below:DECLARE @bal_gen FLOAT DECLARE @bal_shp FLOAT DECLARE @bal_sho FLOAT DECLARE @tab_id INT
INSERT INTO #Temp (cargo_required, amount_general, amount_ship, amount_shore) SELECT 5000, 1500, 1450, 1490 UNION ALL SELECT 0, 3500, 3500, 3500 UNION ALL SELECT 7000, 4500, 4550, 4560 UNION ALL SELECT 0, 2500, 2000, 2000
SELECT @bal_gen=0,@bal_shp=0,@bal_sho=0 SELECT @tab_id=MIN(rec_id) FROM #Temp
WHILE @tab_id IS NOT NULL BEGIN UPDATE #Temp SET @bal_gen=balance_general =CASE WHEN cargo_required > 0 THEN cargo_required ELSE @bal_gen END - amount_general , @bal_shp=balance_ship = CASE WHEN cargo_required > 0 THEN cargo_required ELSE @bal_shp END - amount_ship , @bal_sho=balance_shore = CASE WHEN cargo_required > 0 THEN cargo_required ELSE @bal_sho END - amount_shore WHERE rec_id = @tab_id
SELECT @tab_id=MIN(rec_id) FROM #Temp WHERE rec_id >@tab_id END
Select * FROM #Temp This is what acutally I am having in my stored procedure except the temporary table. The values which I am inserting here will get from my actual tables. What I need is to calculate balance. If you run this script you can see how the balance is calculating using the WHILE loop.
I want an efficient way to calculate the same. Is there any way to calculate it without using loop methods. Thanks and Regards Boney
My company has recently transitioned to a centralized Oracle database model. For the sake of security, the "powers that be" have also denied any query ability to any central tables. They refuse to create views or any other open tables for people to query. Instead, they provide a "tool" which people can use to download data - to Excel Spreadsheets. In the past, before this "improvement" lots of users in the local plants were able to query the old system to bring data into spreadsheets for reports, analysis, etc. Now the place is jammed to the hilt with linked spreadsheets - people do their "table joins" with linked cells and Excel VLookups (yuk). This is because the "powers that be" still demand that these reports, analysis, etc. be done.
I am trying to use SQL-DMO to create a table join between one of these Excel Data pulls and a MS SQL Server table in Excel so that I can join without VLookup. IS SQL-DMO the right way to go?
Has anyone done this? I think I am close, but I don't know how to use the SQL-DMO attached Excel table object I've created in a join. I can't see the object in MS Query. I am not adverse to doing the whole thing in VBA...
Here is another question. Most of these Data pulls using the "tool" (ball and chain, boat anchor) are done once a day or once a week. Would a better strategy be to create MS SQL server Tables that are dropped and re-written when the data is pulled into Excel? This would mean that the report worksheet does not have to import the Excel Data pull sheet to MS SQL when it updates its query.
I've a problem with excel destination spread sheet.I've created a package which pulls the data from sql server and load it into excel sheet.The main thing Ive to do is I've to create different destination tables(work sheets) for different data.i.e.,The source is a sql query which pulls the data in groupwise with group by clause.So,I've to create individual work sheet for each group with that data.How it can be done.Please, advice me.
hi all any body help me for my problem in my code i need to update my sql from excel sheet. but my excel sheet must be open all time, coz it connected with server to update value into this excel sheet.
and i put this code in calc event into this excel sheet:
SqlCom.CommandText = "Update DirectMarket Set DirectMarket.StockVolume=T2.Volume, from DirectMarket inner join (Select * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0','Excel 8.0;Database=D: est.xls;HDR=YES','SELECT * FROM [Sheet1$]')) T2 On DirectMarket.StockSymbol = t2.Symbol "
but this code ask me to close excel sheet to complete update data into SQL server. i cant close file cose it updated all time.
so please i want to know how can i do update data while excel file is open ????
Hi, i have created a rdl file with 10 columns.Also i have an aspx page which will list the ten columns. The user can select some columns and on clicking report button report will be generated in PDF format(Using the rdl file). Now i want to apply style sheet to the report dynamically from aspx page.. how to do that..Help me. Thanks in advance
I'm just starting with SSIS and want to create a reusable package which imports from an excel file which can be specified at runtime. I can expose the filename of the excel file as part of the connectionString property but the sheet is the openrowset property which is a custom property and therefore isn't exposed as part of the external configuration. Does this make sense? Is there an easy way to specify the sheet to import at run time?
I've got this query inside a Sql Task against a Excel connection and I'd like to insert that value into a user variable called "Proyecto". How do I such thing?
Hi , I am using SQL Server Business Inteligence Developement Studio for SSIS. I want to change the Excel FileName and Sheet name for excel source at the run time. Please suggest me how is it possible.
I have a For Each Loop which cycles through some Excel files which is delivered to a FTP location.
In the loop the DataFlow Task uses a Excel Connection Manager, in which you have to specify which sheet you want to take the data from.
But what can i do if the sheet name is different from file to file ?
I was thinking about a script task which somehow can read the first sheet in the Excelfile thats found in the Loop -> put it into a variable -> and use that value to build the query in the Excel Source
In admin tool of my application,i want to give facility to administrator that he can import data from the Excel Sheet and can insert in sql database. for example...user id and password that from excel sheet to user table in sql database. how can i do this..please help me. it's urgent. thanks raj