Raw File Reader Utility?

Jan 5, 2007

Does anyone happen to know if there is a raw file reader utility available? One of my processes drops a couple of interim raw files and I'd like to be able to look at the data in them in a columnar format without having to run a downstream data flow with a reader inserted.

View 8 Replies


ADVERTISEMENT

SqlDataReader Reader Connection Closing Before Dt.Load(reader)

Jun 26, 2007

As you see in the images the connection is closing. During the read it counts 5 columns which is correct. When I step through the code it closes the connection when it hits dt.Load(reader) and nothing is loaded into the datatable.
 
------------------------------------------------------------AS I STEP THROUGH -----------------------------------------------------------------------------------------------------------------------

 
Please help,
 
Thanks,
Tom

View 1 Replies View Related

How To Reader Header And Footer In EBCDIC File?

Jun 19, 2007

I have data arriving in fixed-width EBCDIC format. Each file contains one or more groups of records. Before and after each group there is a header/footer, which is not in the same layout as the records that it describes. Header, record and footer each have a different layout to the other but are consistent within themselves.



Thankfully the one thing header, footer and record layout have in common is their length, so at the moment, using the appropriate code page in the Flat File Connection Manager, I'm able to read all the columns as strings. The headers and footers just come through, albeit a bit weird looking, and I can filter them out with a conditional splt.



However, the header contains information that needs to be appended to each record in the group. Does anyone have any suggestions about how to achieve this? I'm trying to avoid developing a custom data source for this task but, if there's no other way, has anyone done it and do they have any tips?

View 3 Replies View Related

DOS Utility For File Deletion.

Apr 17, 2008

Does anyone has a script/exe for periodic file deletion, using date comparison?


------------------------
I think, therefore I am - Rene Descartes

View 9 Replies View Related

Can The Need For A Reader Loop Be Eliminated In ADO If I Want Query Results To Stream Right To A File?

Oct 23, 2007

I'd like the results of my query to stream right to a file rather than be processed row by row in an ADO reader loop. Is this possible?

View 5 Replies View Related

Client Network Utility Inf File?

Aug 25, 2006

Is there an INF file or a registry entry for the client network utility that I can move from machine to machine? I hate having to re-enter all of my SQL servers and alias' every time I install Tools on a new machine...Any help is greatly appreciated!!

View 1 Replies View Related

Can't Find CSV-file After Using BCP-utility In Stored Procedure

Jan 19, 2008

Hello peopleI have an issue with the Bulk Copy Program-utility.When I execute the BCP in the commandline, it will create a CSV-file.Code in commandline:




Code Block

bcp.exe PCVO.dbo.tblOpleidingen out "C:planning.csv" -c -t";", -eE:Rakoerror.log -Uxx -Pxx -Sservername
Code in stored procedure:




Code Block

USE [PCVO]
GO
/****** Object: StoredProcedure [dbo].[sp_ExportAccessToCSV] Script Date: 01/19/2008 16:36:20 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER PROCEDURE [dbo].[sp_ExportAccessToCSV]
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;

DECLARE @sql varchar(8000)

SET @sql = 'bcp.exe PCVO.dbo.tblOpleidingen
out "C:planning.csv" -c -t";", -eE:Rakoerror.log -Uxx -Pxx -S' + @@servername

EXEC xp_cmdshell @sql

END
Code in C#-application:



Code Block

String connectionString = "Data Source=THUIS-LENNY\SQLEXPRESS;Initial Catalog=PCVO; Integrated Security=True";

System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection(connectionString);
con.Open();

System.Data.SqlClient.SqlCommand da = new System.Data.SqlClient.SqlCommand("sp_ExportAccessToCSV", con);
da.CommandType = CommandType.StoredProcedure;
da.ExecuteNonQuery();
When I use the BCP-utility inside a stored procedure (called in a C#-application),using the xp-cmdshell, I can't find the created file. I even don't get an error or warning message.Can somebody help me?Thanks in advance,G VossiusNB: I'm using SQL Server 2005, Visual Studio 2008 C# EE

View 1 Replies View Related

Can't Find CSV-file After Using BCP-Utility In Stored Procedure

Jan 19, 2008

Hello people
I have an issue with the Bulk Copy Program-utility.
When I execute the BCP in the commandline, it will create a CSV-file.

Code in commandline:



Code Blockbcp.exe PCVO.dbo.tblOpleidingen out "C:planning.csv" -c -t";", -eE:Rakoerror.log -Uxx -Pxx -Sservername






Code in stored procedure:



Code Block
USE [PCVO]
GO
/****** Object: StoredProcedure [dbo].[sp_ExportAccessToCSV] Script Date: 01/19/2008 16:36:20 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[sp_ExportAccessToCSV]
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
DECLARE @sql varchar(8000)
SET @sql = 'bcp.exe PCVO.dbo.tblOpleidingen
out "C:planning.csv" -c -t";", -eE:Rakoerror.log -Uxx -Pxx -S' + @@servername

EXEC xp_cmdshell @sql

END






Code in C#-application:



Code Block
String connectionString = "Data Source=THUIS-LENNY\SQLEXPRESS;Initial Catalog=PCVO; Integrated Security=True";
System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection(connectionString);
con.Open();
System.Data.SqlClient.SqlCommand da = new System.Data.SqlClient.SqlCommand("sp_ExportAccessToCSV", con);
da.CommandType = CommandType.StoredProcedure;
da.ExecuteNonQuery();





When I use the BCP-utility inside a stored procedure (called in a C#-application),
using the xp-cmdshell, I can't find the created file. I even don't get an error or warning message.
Can somebody help me?
Thanks in advance,

G Vossius

NB: I'm using SQL Server 2005, Visual Studio 2008 C# EE

View 4 Replies View Related

Running A SQL File From OSQL Command Line Utility

Jul 20, 2005

Hi,I have dumped a very large database from mysql (using mysqldump program)as a raw sql file. The reason was, convert this database to a MSSQLdatabase. Since mysqldump creates the file as raw sql file with thedatabase-table structures and the data in it, I thought using OSQL commandline utilities should work to out this whole database in MSSQL server.I have run this command from command line:osql -u sa -i mysqldump.sqlIt is going since yesterday. It has been almost 36 hours that it'sstarted. And in the mssql server, I see no database created yet. On thescreen of the command line, I see bunch of numbers are going in order. Iassume they are row numbers of the tables processed. But, if it is doing it,then where is it saving all this data ? I have checked the tempdb, pub db,other dbs, and I see no tables related to the database I am inserting. Willit populate it at the and of the job ? Or, am I doing something wrong here?Regards.Murtix.

View 2 Replies View Related

How To Use Deployment Utility Using A Single Package Configuration File

Jan 22, 2007

Hi,

We are trying to create a deployment utility for a solution. The issue we are facing is, we are using a single package configuration file and when we try to build the solution to create the deployment utility, the build process fails saying that the package configuration file already exists. THe reason for this is while trying to build, the utility copies the configation fiel for the packages, it copies for one, but for the second onward, when it tries to copies, it fails saying the file already exists.



Any idea how to overcome this, or else any suggestions how to perform the similar steps to create a deployment utility for a solution in which the packages share a single package configuration file.

Any suggestion would be really appreciated.



Thanks in Advance,

Manish Singh

View 5 Replies View Related

The Database File May Be Corrupted. Run The Repair Utility To Check The Database File. [ Database Name = SDMMC Storage Cardwinp

Oct 9, 2007

yes,I have an error, like 'The database file may be corrupted. Run the repair utility to check the database file. [ Database name = SDMMC Storage Cardwinpos_2005WINPOS2005.sdf ]' .I develope a program for Pocket Pcs and this program's database sometimes corrupt.what can i do?please help me

View 4 Replies View Related

Errors During Building Project With Deployment Utility And Configuration File

Sep 28, 2005

I am getting following error when "CreateDeploymentUtility" is set to true and I try building the solution. It tries to copy a file that already exits in inDeployment folder.  I am using Sept. CTP.

View 4 Replies View Related

Using XP_CmdShell To Execute BCP Utility With QUERYOUT. How To Control The OWNER Of The File Created?

Jan 29, 2008

I need the file created by my BCP QUERYOUT command I'm executing from XP_CmdShell in Transact-SQL to have a specific OWNER. I've tried using the sp_xp_cmdshell_proxy_account to setup the correct owner. The owner is always SERVERNAMEAdministrators.

thanks,

jim




View 1 Replies View Related

NULL Values Returned When Reading Values From A Text File Using Data Reader.

Feb 23, 2007

I have a DTSX package which reads values from a fixed-length text file using a data reader and writes some of the column values from the file to an Oracle table. We have used this DTSX several times without incident but recently the process started inserting NULL values for some of the columns when there was a valid value in the source file. If we extract some of the rows from the source file into a smaller file (i.e 10 rows which incorrectly returned NULLs) and run them through the same package they write the correct values to the table, but running the complete file again results in the NULL values error. As well, if we rerun the same file multiple times the incidence of NULL values varies slightly and does not always seem to impact the same rows. I tried outputting data to a log file to see if I can determine what happens and no error messages are returned but it seems to be the case that the NULL values occur after pulling in the data via a Data Reader. Has anyone seen anything like this before or does anyone have a suggestion on how to try and get some additional debugging information around this error?

View 12 Replies View Related

Log Reader

Aug 22, 2007

We dont want to use triggers or replication to capture changes in a set of tables; we have the same problem in Oracle and we use LogMiner to do so. We have been looking for similar tools in SQL Server but the ones we have found so far dont seem to fulfill our requirements (Redgate and Lumigent).
Does anyone know any other third party application that can read a SQL Server log and extract changes filtering by table name?

Thanks.

View 1 Replies View Related

Data Reader ?

Sep 24, 2007

is it possible to use a data reader to read from 2 tables with 1 store procedure(sp)?
 -------------------------------------------------
ex:
create sp1
as 

select * from tbl1
select * from tbl2
 -------------------------------------------------
 how can i use a data reader to read the items from tbl2?
 

 
 

View 5 Replies View Related

Data Reader

Feb 22, 2008

Hi Guys,I have a quick question about DataReader, I have a function called "ExportTotal" i am calling this function from another function. what it does is it will put the Total for each Network in the Line 34. Right now what it is doing is It is putting the First Networktotal,2ndNetwork total,3rdNetwork total....... in the line 34. what i want is if the control comes to first network then it has to put only 1st network total and for the 2nd network only 2nd network total and so on. Please see my function below. Can you guys tell me what i am doing wrong?ThxPrivate Function exporttotal() As String Dim sql As String Dim dbFunctions As New DatabaseUtilities Dim tempinvoicetotal As String 'Dim rateactuals As String Dim filetext As String Dim tempclientname As String Dim strconn As String Dim prev_network As String = "" Dim current_network As String = "" strconn = CONNECTIONSTRING sql = "SELECT CAST(SUM(tblSpot.rateActual) AS int(4)) AS Rateactuals, SUM(tblSpot.rateActual * 0.85) AS netrate, SUM(tblSpot.rateActual * 0.15) AS commrate,TBLCLIENT.CLIENTNAME " & _"FROM tblSpot INNER JOIN tblContract ON tblSpot.fkContract = tblContract.pkid INNER JOIN " & _ " tblClient ON tblContract.fkClient = tblClient.pkid WHERE tblSpot.fkContractType = 'UNWIRED' AND " & _ "fkInvoiceNumber = '" & Me.txtinvoicenumber.Text & "' GROUP BY TBLCLIENT.CLIENTNAME" Dim myConn As New SqlConnection(CONNECTIONSTRING) Dim myCommand As New SqlCommand(sql, myConn) myConn.Open() Dim dbreader As SqlDataReader = myCommand.ExecuteReader() While dbreader.Read() Try Dim Rateactuals As String If dbreader("Rateactuals") Is DBNull.Value Then Rateactuals = "" Else Rateactuals = dbreader("Rateactuals") tempinvoicetotal = Rateactuals End If Dim clientname As String If dbreader("clientname") Is DBNull.Value Then clientname = "" Else clientname = dbreader("clientname") tempclientname = clientname End If If prev_network = "" Then filetext = filetext & vbCr & "34;;" & tempinvoicetotal & "00" & ";"Session("EDIExport4") = filetext prev_network = tempclientname Else current_network = tempclientname If prev_network <> current_network Then filetext = filetext & vbCr & "34;;" & tempinvoicetotal & "00" & ";"Session("EDIExport4") = filetext prev_network = tempclientname Else End If End If Catch SqlEx As SqlClient.SqlException Session("Error") = SqlEx.Message.ToString Response.Redirect("Error.aspx?Form=" & Request.Path) Catch Ex As System.Exception Session("Error") = Ex.Message.ToString Response.Redirect("Error.aspx?Form=" & Request.Path) End Try dbFunctions = Nothing End While myConn.Close() End Function

View 7 Replies View Related

ADO.net (how To Close A Reader)

Nov 29, 2005

Hello, I'm trying to run the following snippet as Console app, and I get an error: "a reader is already open for this connection, and should be closed first" I tried to manually say: SqlDataReader.Close() in the begining of the code, but still get the error, Any suggecstions how to manually close the reader? thank you ---------- here's the code -----------using System; using System.Data; using System.Data.SqlClient; using System.Data.SqlTypes; namespace ADO.NET { /// <summary> /// Summary description for Class1. /// </summary> class Class1 { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main(string[] args) { SqlConnection cn = new SqlConnection ("SERVER=MyServer; INTEGRATED SECURITY=TRUE;" + "DATABASE=AdventureWorks"); SqlCommand cmd1 = new SqlCommand ("Select * from HumanResources.Department", cn); cmd1.CommandType = CommandType.Text; try { cn.Open(); SqlDataReader rdr = cmd1.ExecuteReader(); while (rdr.Read()) { if (rdr["Name"].ToString() == "Production") { SqlCommand cmd2 = new SqlCommand("SELECT * FROM " + "HumanResources.Employee WHERE DepartmentID = 7", cn); cmd2.CommandType = CommandType.Text; SqlDataReader rdr2 = cmd2.ExecuteReader(); while (rdr2.Read()) { } rdr2.Close(); } } rdr.Close(); } catch (Exception ex) { Console.WriteLine (ex.Message); } finally { cn.Close(); } } } }

View 2 Replies View Related

Problems With More Than 1 Reader

Mar 13, 2006

Dim conn As SqlConnection = Nothing
Dim cmd As SqlCommand
Dim cmd2 As SqlCommand
try
conn = New SqlConnection(ConfigurationManager.ConnectionStrings("myConnection").ConnectionString)
conn.Open()
cmd = New SqlCommand
cmd.Connection = conn

cmd2 = New SqlCommand
cmd2.Connection = conn
dim reader As SqlDataReader = cmd.ExecuteReader
Right this works and I can access reader fine
but as soon as I do the following I get an error
reader2 = cmd2.ExecuteReader (reader2 is already declared just not put on here)
the error is "There is already an open DataReader associated with this Command which must be closed first."
which is odd because there sqlcommand used for reader2 is different.
Can I not use more than one reader at anyone time? I used to have loads of recordsets open in asp 3 no prob.
Cheers

View 3 Replies View Related

Datasource Reader

Apr 28, 2008

I am trying to do incremental extract using Datasource reader.
I need to send a variable in where condition to extract the data base on the max date from other table.


To implement this i have created two variables
1)to get the max date from the table.
2)to store the sql query and send the mad date from other variable to extract the data.

i have give this sql variable in data flow expression.but its not working.

can any one tell me where i am going wrong.

View 2 Replies View Related

Log Reader Internal

Apr 26, 2007

MY Current database in SIMPLE recoverey model



I have set up the transactional replication. MY log reader process wakes up and runs every 5 min. Does my transactions will get deleted or they still in log file as active even it is in simple recover model.



Logreader how it reads the Transaction log files .? I observed today we are running some big reports. those reports uses INSERT INTO FROM <TABLE > this process showing in DBCC OPENTRAN

MY log reader keep on reading the log file.. it did not come out from that five min duration...



Can someone from the MS share the what /how exactly log reader works ( inside details)

I would like to add more details



The Log Reader Agent is scanning the transaction log for commands to be replicated. Approximately 30500000 log records have been scanned in pass # 3, 1696 of which were marked for replication, elapsed time -623164036 (ms).

The Log Reader Agent is scanning the transaction log for commands to be replicated. Approximately 31000000 log records have been scanned in pass # 3, 1713 of which were marked for replication, elapsed time -177869239 (ms).

everytiome counter startwith 500000 records and keegoing for some time and it is delivering the transactions never stopping the job

Why elpse time is in negative?



How to understan

Do you guys think it is really sc



Thanks

Srini

View 25 Replies View Related

Sqldata Reader Question

Jul 18, 2006

Hi,
I am trying to creating an application using C# where I read data from a SQL server. In the database, I have two tables. One that has the Order info and other table has the item info for each of the rows in the Order table. In my application I am run a query and open up a datareader to read in the Order info. While OrderInfoDataReader is still open, I run another query to get the ItemInfo and open another data reader. Well, ADO.Net does not allow two datareader be open at the same time.
My question, what would be a way around to solve the issue? I would greatly appreciate your help.
Thanks,
Emon.

View 1 Replies View Related

Help Retreving Value Form Sql Reader

Aug 18, 2006

hello,
 
I have tried myReader.GetSqlString, GetSqlValue, GetSqlInt16, etc...etc...
But I keep getting an error (System.InvalidCastException was caught  Message="Conversion from type 'SqlInt32' to type 'String' is not valid."  Source="Microsoft.VisualBasic"  StackTrace:       at Microsoft.VisualBasic.CompilerServices.Conversions.ToString(Object Value)       at ImportDelimitedFile.SumCurrentAmount() in C:Documents and Settingsemg3703My DocumentsVisual Studio 2005EscuelasComunidadImportDelimitedFile.aspx.vb:line 556)
 
Here is my code:
 Public Function SumCurrentAmount() As String        Dim sqlconn As New SqlConnection(ConfigurationManager.ConnectionStrings("GDBRemitanceConnectionString1").ConnectionString)        Dim sqlcmd As New SqlCommand("SELECT SUM(CONVERT (Int, Field_6)) AS TotalAmount, Record_Type FROM tblTempWorkingStorage_NACHA GROUP BY Record_Type HAVING (Record_Type = '6')", sqlconn)        Try            sqlcmd.Connection.Open()            Dim myReader As SqlDataReader            myReader = sqlcmd.ExecuteReader(CommandBehavior.CloseConnection)            If myReader.Read() Then                SumCurrentAmount = CType(myReader.GetSqlValue(0), String)                Return SumCurrentAmount            Else            End If            myReader.Close()        Catch        End Try        sqlcmd.Connection.Close()    End Function
 
I need to know which "GetSql...(type) should I used to extract field numbre one from myReader.
 
Thanks a lot,

View 1 Replies View Related

Data Reader Problem

Jun 11, 2007

Hi All,
   I got an error while running this code.There is already an open DataReader associated with this Command which must be closed first
  How can I resolve the error?
 
protected void Page_Load(object sender, EventArgs e)    {        string sql;                SqlConnection Connection = new SqlConnection("ConnectionString");        sql = "SELECT PO_SE_Line_ID  FROM  PO_STOCK_QUERY_LINE_DETAILS WHERE TRANS_NUM ='TR-A-00-01-93'";
        SqlCommand command = new SqlCommand(sql, Connection);        SqlDataReader Dr;        Connection.Open();        Dr = command.ExecuteReader();                                while (Dr.Read())                {
 sql = "SELECT SUPPLIER_ITEM_CODE,SUPPLIER_MAN_DESC,SUPPLIER_PAT_DESC,SUPPLIER_ITEM_DESC,SUPPLIER_ADDIT_DESC,SUPPLIER_SUGG_RETAIL FROM PO_STOCK_QUERY_LINE_DETAILS where TRANS_NUM ='TR-A-00-01-93' and PO_SE_Line_ID=" + Dr["PO_SE_Line_ID"].ToString();
               SqlCommand command1 = new SqlCommand(sql, Connection);
               SqlDataReader Dr1;
                   
                    Dr1 = command1.ExecuteReader();                                        while(Dr1.Read())                    {
 
                    Response.Write(Dr["SUPPLIER_ITEM_CODE"].ToString());                    Response.Write("<br>");                    Response.Write(Dr["SUPPLIER_MAN_DESC"].ToString());                    Response.Write("<br>");                    Response.Write(Dr["SUPPLIER_PAT_DESC"].ToString());                    Response.Write("<br>");                    Response.Write(Dr["SUPPLIER_ITEM_DESC"].ToString());                    Response.Write("<br>");                    Response.Write(Dr["SUPPLIER_ADDIT_DESC"].ToString());
      }Dr1.Close();
     }Dr.Close();
 
I tried to close the first data reader before opening the second data reader.still the error persists.

View 5 Replies View Related

Data Reader Problem

Jun 26, 2007

Hi, i dont know whats gone wrong! but all of a sudden it seems to be throwing an error, i have looked at my previous code and it matches exactly when it was working, here is the code below int i = 0;for (i = 1; i <= 3; i++)
{
 
//This gets the stock ID from the textbox.string stock_ID = ((TextBox)Panel1.FindControl("txtID" + i.ToString())).Text;
 
//This is the sql statement.string sql = "SELECT [n_or_sh], [title], [cost_price], [selling_price] FROM tbl_stock WHERE stock_ID = " + stock_ID;
 
//This creates a sql command which executes the sql statement.SqlCommand sqlCmd = new SqlCommand(sql, myConn);
myConn.Open();
//This is a reader for the results to go in.SqlDataReader dr = sqlCmd.ExecuteReader();
//This reads the first result from the sqlReader
dr.Read();
//This sets the title label text to the value of the description column.TextBox currentBox1 = (TextBox)Panel1.FindControl("txtDesc" + i);
string strtxtDesc = currentBox1.Text;strtxtDesc = dr["title"].ToString();
 
 
};
myConn.Close();
i = 0;
 
the error its throwing is this
CS1519: Invalid token '(' in class, struct, or interface member declaration for the line myConn.Open()
does anybody have any idea how to solve this?
Jez

View 4 Replies View Related

Coexisting SQL Reader && UPDATE

Aug 17, 2007

In my current application, I have an administration form that fills in labels and checked states via data entered into the database using a similar user input field. What the admin page does is it first lists all the record names in a listview, then on select, it fills in the form based on what the records contain. This means labels text change, and check states change based on the string "True" or "False". This was done using the SQL Reader command.
 Within the same form, the read checkboxes are editable via the admin. When the admin edits the controls, he will click the update button at the bottom and the database will UPDATE .. WHERE UserName = (Scalar for ListBox1.SelectedValue)
I've used the exact same UPDATE command in my form for the user, except the only difference was @ the WHERE clause-- I had it updating based on a GUID. I know my SQL statement is correct, but it just won't update the data.
Is it possible that the READER, which starts (and closes) on pageload cannot coexist within the same form as the UPDATE code?
My code is incredibly long, so for the purposes of a short post I'm not including any bit of it-- but if you would like to see it, just let me know.

View 5 Replies View Related

Sqldatareader Within A Loop From Another Reader?

Dec 26, 2007

I have an SqlDataReader which loops through records returned from an SP, within that loop I would like to initiate another SP, but for some darn reason the following code won't work: // create SqlConnection object
string ConnectionString = ConfigurationManager.ConnectionStrings["aiv3cs"].ConnectionString;
SqlConnection myConnection = new SqlConnection(ConnectionString);

try
{
// Create a new XmlTextWriter instance
XmlTextWriter writer = new
XmlTextWriter(Server.MapPath("products.sitemap"), Encoding.UTF8);

writer.WriteStartDocument();
writer.WriteStartElement("siteMap");
writer.WriteAttributeString("xmlns", "http://schemas.microsoft.com/AspNet/siteMap-File-1.0");

// create the command
SqlCommand myCommand = new SqlCommand();
myCommand.Connection = myConnection;

// set up the command
myCommand.CommandText = "spGetMenuStructure";
myCommand.CommandType = CommandType.StoredProcedure;

// open the connection
myConnection.Open();

// run query
SqlDataReader myReader = myCommand.ExecuteReader();

bool HasSubElements = false;

SqlCommand myCommand2 = new SqlCommand();
SqlParameter myParameter1 = new SqlParameter();
SqlDataReader myReader2 = new SqlDataReader();

// parse the results
while (myReader.Read())
{
// create the command
myCommand2.Connection = myConnection;

// set up the command
myCommand2.CommandText = "spGetMenuSubElements";
myCommand2.CommandType = CommandType.StoredProcedure;

myParameter1.ParameterName = "@ContentID";
myParameter1.SqlDbType = SqlDbType.Int;
myParameter1.Value = Convert.ToString(myReader["ID"]);

myCommand2.Parameters.Add(myParameter1);

// run query
myReader2 = myCommand2.ExecuteReader();

while (myReader2.Read())
{
HasSubElements = true;
}

myReader2.Close();

if (Convert.ToString(myReader["HasPage"]) == "1")
{
writer.WriteStartElement("siteMapNode");
writer.WriteAttributeString("title", Convert.ToString(myReader["PageTitle"]));
writer.WriteAttributeString("description", Convert.ToString(myReader["PageTitle"]));

string PageURL = Convert.ToString(myReader["PageName"]) + "?ContentID=" + Convert.ToString(myReader["ID"]);

writer.WriteAttributeString("url", PageURL);

if (HasSubElements)
{
writer.WriteEndElement();
}
}
else
{
writer.WriteStartElement("siteMapNode");
writer.WriteAttributeString("title", Convert.ToString(myReader["PageTitle"]));
writer.WriteAttributeString("description", Convert.ToString(myReader["PageTitle"]));
}

HasSubElements = false;
}

myReader.Close();

// end the xml document and close
writer.WriteEndElement();
writer.WriteEndDocument();
writer.Close();
}

finally
{
myConnection.Close();
}I've gotten the following two errors:There is already an open DataReader associated with this Command which must be closed first.And a build error:Error29The type 'System.Data.SqlClient.SqlDataReader' has no constructors defined Any suggestions would be most appreciated.    

View 4 Replies View Related

Data Reader Question

Feb 11, 2008

Hi Guys,I have a quick question about DataReader, I have a function called "ExportTotal" i am calling this function from another function. what it does is it will put the Total for each Network in the Line 34. Right now what it is doing is It is putting the First Networktotal,2ndNetwork total,3rdNetwork total....... in the line 34. what i want is if the control comes to first network then it has to put only 1st network total and for the 2nd network only 2nd network total and so on. Please see my function below. Can you guys tell me what i am doing wrong?ThxPrivate Function exporttotal() As String Dim sql As String Dim dbFunctions As New DatabaseUtilities Dim tempinvoicetotal As String 'Dim rateactuals As String Dim filetext As String Dim tempclientname As String Dim strconn As String Dim prev_network As String = "" Dim current_network As String = "" strconn = CONNECTIONSTRING sql = "SELECT CAST(SUM(tblSpot.rateActual) AS int(4)) AS Rateactuals, SUM(tblSpot.rateActual * 0.85) AS netrate, SUM(tblSpot.rateActual * 0.15) AS commrate,TBLCLIENT.CLIENTNAME " & _"FROM tblSpot INNER JOIN tblContract ON tblSpot.fkContract = tblContract.pkid INNER JOIN " & _ " tblClient ON tblContract.fkClient = tblClient.pkid WHERE tblSpot.fkContractType = 'UNWIRED' AND " & _ "fkInvoiceNumber = '" & Me.txtinvoicenumber.Text & "' GROUP BY TBLCLIENT.CLIENTNAME" Dim myConn As New SqlConnection(CONNECTIONSTRING) Dim myCommand As New SqlCommand(sql, myConn) myConn.Open() Dim dbreader As SqlDataReader = myCommand.ExecuteReader() While dbreader.Read() Try Dim Rateactuals As String If dbreader("Rateactuals") Is DBNull.Value Then Rateactuals = "" Else Rateactuals = dbreader("Rateactuals") tempinvoicetotal = Rateactuals End If Dim clientname As String If dbreader("clientname") Is DBNull.Value Then clientname = "" Else clientname = dbreader("clientname") tempclientname = clientname End If If prev_network = "" Then filetext = filetext & vbCr & "34;;" & tempinvoicetotal & "00" & ";"Session("EDIExport4") = filetext prev_network = tempclientname Else current_network = tempclientname If prev_network <> current_network Then filetext = filetext & vbCr & "34;;" & tempinvoicetotal & "00" & ";"Session("EDIExport4") = filetext prev_network = tempclientname Else End If End If Catch SqlEx As SqlClient.SqlException Session("Error") = SqlEx.Message.ToString Response.Redirect("Error.aspx?Form=" & Request.Path) Catch Ex As System.Exception Session("Error") = Ex.Message.ToString Response.Redirect("Error.aspx?Form=" & Request.Path) End Try dbFunctions = Nothing End While myConn.Close() End Function

View 5 Replies View Related

REPLICATION: Log Reader Problems

Mar 19, 2001

Log Reader:

The process could not execute 'sp_repldone/sp_replcounters' on 'prdSQL01'.

I have configured replication locally; from prdSQL01 to prdSQL01 in order to
troubleshoot this problem.

Is the problem is local to the box?????????

Do I need to re-install MSSQL SERVER? CORRUPT INSTALL????

HELP IS DESPERATELY NEEDED. APPRECIATE ALL SUGGESTIONS.
THANKS
SAM

View 4 Replies View Related

Log Reader And Login Capture

Aug 31, 2001

Is there a way I can view the transaction log mean I want to see the transactions occurred during the last few hours before the commit? And is there a way to capture all the logins who access the DB

View 1 Replies View Related

Log Reader Agent Won't Start

Jun 22, 2004

We restored a database with replicated tables. Now, the Log Reader Agent will not run. This displays:
"The process could not execute 'sp_repldone/sp_replcounters' on 'ourservername'."
In Error Details for the agent:
"The process could not set the last distributed transaction."
And, from the logs:
"ForwardLogBlockReadAheadAsync: Operating system error 998(Invalid access to memory location.) encountered."

Does anyone know how we get the Distribution database and the Log Reader running again?
It is only affecting Transactional replication (not snapshot or merge).

View 4 Replies View Related

Free Transaction Log Reader

Apr 19, 2004

There have been deleted several records from a table and i want to know who did it. Is there a free transactionlog reader to find out?

Marcel

View 2 Replies View Related

Writer Block Reader, Reader Block Writer...

Sep 27, 2005

hi,

i've performed a test on 2 machines based on the topic above, but it doesn't seem like blocking each other... This is the context...

I've created a table call TEST_DEL i.e.
quote:CREATE TABLE test_del
(v_id INT,
desc CHAR(3)
)

In machine 1, i'm login as USER 1 and try to insert a set of records into the table
quote:
Machine 1
~~~~
BEGIN
DECLARE @li_num int,
@li_start int

SET @li_num = 100000
SET @li_start = 1

WHILE @li_start < @li_num
BEGIN
INSERT INTO test_del VALUES (@li_start, 'zzz', 'xxx')

IF (@li_start > @li_num)
BREAK
ELSE
SET @li_start = @li_start + 1
CONTINUE

END
END




In machine 2, i login in as USER 2 to retrieve the records at the same time...
quote:
SELECT * FROM test_del


but, the system still allow me to retrieve the records at the same time... May i know when will "Writer block reader, reader block writer" occur and in what situation

Thanks in advance

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved