Showing posts with label source. Show all posts
Showing posts with label source. Show all posts

Wednesday, March 28, 2012

How to show data in a Label item?

SqlCeConnection cn = new SqlCeConnection("Data Source=\\Program Files\\test\\tel.sdf");
try
{
SqlCeCommand cmd = cn.CreateCommand();

cmd.CommandText = "SELECT * from phone where PhoneNo = '0912312345'";

SqlCeDataAdapter adp = new SqlCeDataAdapter(cmd);

DataSet ds = new DataSet();

adp.Fill(ds);
this.dataGrid1.DataSource = ds.Tables[0];

label1.Text =Convert.ToString(?);

label2.Text =Convert.ToString(?);

}

finally
{
if (cn.State != ConnectionState.Closed)
{
cn.Close();
}
}

I can show the result in the DataGrid1

however, I want the label1 to show the Name,

and label2 to show the phoneNo.

how to do in here,

label1.Text =Convert.ToString(?);

label2.Text =Convert.ToString(?);

thanks

DataSet is a collection of DataTables and DataTable is a collection of rows and columns. You can access data in the table directly as you would do it with array:

label1.Text = ds.Tables[0].Rows[row_index_here][colum_index_or_name_here].ToString();

Alternatively you can bind your label so it would be updated automatically as you change current row in the grid:

label1.DataBindings.Add("Text", ds.Tables[0], "ColumnNameHere");

sql

Friday, March 9, 2012

How to Set Record Length for the Flatfiles in SSIS

I am trying to transfer the data from OLEDB source to Flatfile destination. My Client need the flatfile of Record Length 80 Bytes. What does this means? Does it mean the output width or does it mean the flatfile format should be fixed length? please explain?It means that the sum of the individual column lengths must add up to 80. No less, no more.

You need to find out, though, if there is supposed to be a line feed at the end of each row, in which case you'd want to use a "ragged-right" format. Otherwise, fixed width would work.|||so if i set the output column width of each column to 80, it is all set, as the client dont have further data available.....he does not knw about the line feed......|||No, the columns must ALL add up, in total, to 80.|||great thanks phil.....I think this answers my question for now....i will keep the thread open as i might come up with more questions on this topic|||

one thing more is, if have set the record length for all the columns (total = 80 bytes), now when i name the columns should that also comply with number of bits i have set for each column

for eg

if columnname is MyNumber itz datataype is Varchar and Length is 10 than do MyNumber also be set within 10 Bits limit

|||

B.Chintan wrote:

one thing more is, if have set the record length for all the columns (total = 80 bytes), now when i name the columns should that also comply with number of bits i have set for each column

for eg

if columnname is MyNumber itz datataype is Varchar and Length is 10 than do MyNumber also be set within 10 Bits limit

It depends. If you are outputting column names to the file, then yes. (Even that might not be true, but in general, it is.) If you are not outputting file names to the file, then you can make them however long you need.

|||

I tried the above stated solution, when the column name is not specified it works fine and when column name is specified, it does not work as it wants the names to be within 80 bytes limit.

The problem now is when i try to put this flat files back to database using oledbsource and lookups, I am not able to do that. i encounter problem with format.

In this case i have set the format to fixed width...so when i try to put it in db.....i can see just one column whereas when i converted it to flatfile it had 61 columns and now while reversing it i c everything in one column.

Any step by step procedure to solve this tht is from db to flatfile with fixed width row dilimiter and vice versa

Chintan Shah

|||Then make your column names fit into the 80 bytes length restriction.

Also, use "ragged right" when loading the resulting flat file. But why are you doing this anyway? Just to test the file?|||i need to submit the flat files to an reporting agency now they have certain standards which my client need to follow, putting the flat file back to db is just a test I am doing as tht will be done by the agency when they receive the flat files from us. I will try using ragged right....hope tht works fine.|||

the best solution i did was to transform the db file in 3 format using this

OLEDBSource>>>>MultiCast>>>>3 Diff flatfiles in 3 diff formats.

One important thing to remember is

If the column headings are to be submitted than they should comply to the set Byte Limit. If they are not than column headings can be as long as desired.

Thanks phil for all help.

I would like to know if you have any Knowledge about Microsoft Dynamics and is it a good line to enter or SQL Server is the better option.

Chintan

How to Set Record Length for the Flatfiles in SSIS

I am trying to transfer the data from OLEDB source to Flatfile destination. My Client need the flatfile of Record Length 80 Bytes. What does this means? Does it mean the output width or does it mean the flatfile format should be fixed length? please explain?It means that the sum of the individual column lengths must add up to 80. No less, no more.

You need to find out, though, if there is supposed to be a line feed at the end of each row, in which case you'd want to use a "ragged-right" format. Otherwise, fixed width would work.|||so if i set the output column width of each column to 80, it is all set, as the client dont have further data available.....he does not knw about the line feed......|||No, the columns must ALL add up, in total, to 80.|||great thanks phil.....I think this answers my question for now....i will keep the thread open as i might come up with more questions on this topic|||

one thing more is, if have set the record length for all the columns (total = 80 bytes), now when i name the columns should that also comply with number of bits i have set for each column

for eg

if columnname is MyNumber itz datataype is Varchar and Length is 10 than do MyNumber also be set within 10 Bits limit

|||

B.Chintan wrote:

one thing more is, if have set the record length for all the columns (total = 80 bytes), now when i name the columns should that also comply with number of bits i have set for each column

for eg

if columnname is MyNumber itz datataype is Varchar and Length is 10 than do MyNumber also be set within 10 Bits limit

It depends. If you are outputting column names to the file, then yes. (Even that might not be true, but in general, it is.) If you are not outputting file names to the file, then you can make them however long you need.

|||

I tried the above stated solution, when the column name is not specified it works fine and when column name is specified, it does not work as it wants the names to be within 80 bytes limit.

The problem now is when i try to put this flat files back to database using oledbsource and lookups, I am not able to do that. i encounter problem with format.

In this case i have set the format to fixed width...so when i try to put it in db.....i can see just one column whereas when i converted it to flatfile it had 61 columns and now while reversing it i c everything in one column.

Any step by step procedure to solve this tht is from db to flatfile with fixed width row dilimiter and vice versa

Chintan Shah

|||Then make your column names fit into the 80 bytes length restriction.

Also, use "ragged right" when loading the resulting flat file. But why are you doing this anyway? Just to test the file?|||i need to submit the flat files to an reporting agency now they have certain standards which my client need to follow, putting the flat file back to db is just a test I am doing as tht will be done by the agency when they receive the flat files from us. I will try using ragged right....hope tht works fine.|||

the best solution i did was to transform the db file in 3 format using this

OLEDBSource>>>>MultiCast>>>>3 Diff flatfiles in 3 diff formats.

One important thing to remember is

If the column headings are to be submitted than they should comply to the set Byte Limit. If they are not than column headings can be as long as desired.

Thanks phil for all help.

I would like to know if you have any Knowledge about Microsoft Dynamics and is it a good line to enter or SQL Server is the better option.

Chintan

How to Set Record Lenght for the Flatfiles in SSIS

I am trying to transfer the data from OLEDB source to Flatfile destination. My Client need the flatfile of Record Length 80 Bytes. What does this means? Does it mean the output width or does it mean the flatfile format should be fixed length? please explain?It means that the sum of the individual column lengths must add up to 80. No less, no more.

You need to find out, though, if there is supposed to be a line feed at the end of each row, in which case you'd want to use a "ragged-right" format. Otherwise, fixed width would work.|||so if i set the output column width of each column to 80, it is all set, as the client dont have further data available.....he does not knw about the line feed......|||No, the columns must ALL add up, in total, to 80.|||great thanks phil.....I think this answers my question for now....i will keep the thread open as i might come up with more questions on this topic|||

one thing more is, if have set the record length for all the columns (total = 80 bytes), now when i name the columns should that also comply with number of bits i have set for each column

for eg

if columnname is MyNumber itz datataype is Varchar and Length is 10 than do MyNumber also be set within 10 Bits limit

|||

B.Chintan wrote:

one thing more is, if have set the record length for all the columns (total = 80 bytes), now when i name the columns should that also comply with number of bits i have set for each column

for eg

if columnname is MyNumber itz datataype is Varchar and Length is 10 than do MyNumber also be set within 10 Bits limit

It depends. If you are outputting column names to the file, then yes. (Even that might not be true, but in general, it is.) If you are not outputting file names to the file, then you can make them however long you need.

|||

I tried the above stated solution, when the column name is not specified it works fine and when column name is specified, it does not work as it wants the names to be within 80 bytes limit.

The problem now is when i try to put this flat files back to database using oledbsource and lookups, I am not able to do that. i encounter problem with format.

In this case i have set the format to fixed width...so when i try to put it in db.....i can see just one column whereas when i converted it to flatfile it had 61 columns and now while reversing it i c everything in one column.

Any step by step procedure to solve this tht is from db to flatfile with fixed width row dilimiter and vice versa

Chintan Shah

|||Then make your column names fit into the 80 bytes length restriction.

Also, use "ragged right" when loading the resulting flat file. But why are you doing this anyway? Just to test the file?|||i need to submit the flat files to an reporting agency now they have certain standards which my client need to follow, putting the flat file back to db is just a test I am doing as tht will be done by the agency when they receive the flat files from us. I will try using ragged right....hope tht works fine.|||

the best solution i did was to transform the db file in 3 format using this

OLEDBSource>>>>MultiCast>>>>3 Diff flatfiles in 3 diff formats.

One important thing to remember is

If the column headings are to be submitted than they should comply to the set Byte Limit. If they are not than column headings can be as long as desired.

Thanks phil for all help.

I would like to know if you have any Knowledge about Microsoft Dynamics and is it a good line to enter or SQL Server is the better option.

Chintan

How to set ProhibitDtd in SSIS?

Hi,

I'm having a problem using XML-files as source for dataflow-task.

On the source-editor for XML i chose the XML-file and the XSD-file. After clicking OK SSIS throws an error, saying I need to set ProhibitDtd in XmlReaderSettings to false, otherwise I'm not able to work with this file.

Unfortunatley I dont know were I can set this option.

Regards,

Jan Wagner

It sounds like your source XML file contains embedded DTD. If this is true, try to remove the DTD first.

Regards,
Yitzhak

|||

I'm having the same problem using XML-files as source for dataflow-task.

My XML has an external DTD so removing it from the source is not an option.

So the question is "How can I set the ProhibitDTD in the XMLReaderSettings to false for SSIS processing?"..

|||

Thanks for your answer Yitzhak.

It just seems I mistook DTD with XSD...

Regards,

Jan

|||

Unfortunately, SSIS doesn't expose all existing XML settings.

I don't know if it is possible for you to do.
Try to change the input XML document as a URI string (http://...) instead of the IXPathNavigable (drive:\...)
My guess is when you do that the following is what's happening inside:

XslCompiledTransform creates an XmlReader to read the XML document from this URI using default XmlReaderSettings, but allowing Document Type Definition (DTD):

XmlReaderSettings rs = new XmlReaderSettings();

rs.ProhibitDtd = false;

XmlReader.Create(inputUri, rs);

Regards,
Yitzhak

How to set ProhibitDtd in SSIS?

Hi,

I'm having a problem using XML-files as source for dataflow-task.

On the source-editor for XML i chose the XML-file and the XSD-file. After clicking OK SSIS throws an error, saying I need to set ProhibitDtd in XmlReaderSettings to false, otherwise I'm not able to work with this file.

Unfortunatley I dont know were I can set this option.

Regards,

Jan Wagner

It sounds like your source XML file contains embedded DTD. If this is true, try to remove the DTD first.

Regards,
Yitzhak

|||

I'm having the same problem using XML-files as source for dataflow-task.

My XML has an external DTD so removing it from the source is not an option.

So the question is "How can I set the ProhibitDTD in the XMLReaderSettings to false for SSIS processing?"..

|||

Thanks for your answer Yitzhak.

It just seems I mistook DTD with XSD...

Regards,

Jan

|||

Unfortunately, SSIS doesn't expose all existing XML settings.

I don't know if it is possible for you to do.
Try to change the input XML document as a URI string (/) instead of the IXPathNavigable (drive:\...)
My guess is when you do that the following is what's happening inside:

XslCompiledTransform creates an XmlReader to read the XML document from this URI using default XmlReaderSettings, but allowing Document Type Definition (DTD):

XmlReaderSettings rs = new XmlReaderSettings();

rs.ProhibitDtd = false;

XmlReader.Create(inputUri, rs);

Regards,
Yitzhak

How to set ProhibitDtd in SSIS?

Hi,

I'm having a problem using XML-files as source for dataflow-task.

On the source-editor for XML i chose the XML-file and the XSD-file. After clicking OK SSIS throws an error, saying I need to set ProhibitDtd in XmlReaderSettings to false, otherwise I'm not able to work with this file.

Unfortunatley I dont know were I can set this option.

Regards,

Jan Wagner

It sounds like your source XML file contains embedded DTD. If this is true, try to remove the DTD first.

Regards,
Yitzhak

|||

I'm having the same problem using XML-files as source for dataflow-task.

My XML has an external DTD so removing it from the source is not an option.

So the question is "How can I set the ProhibitDTD in the XMLReaderSettings to false for SSIS processing?"..

|||

Thanks for your answer Yitzhak.

It just seems I mistook DTD with XSD...

Regards,

Jan

|||

Unfortunately, SSIS doesn't expose all existing XML settings.

I don't know if it is possible for you to do.
Try to change the input XML document as a URI string (http://...) instead of the IXPathNavigable (drive:\...)
My guess is when you do that the following is what's happening inside:

XslCompiledTransform creates an XmlReader to read the XML document from this URI using default XmlReaderSettings, but allowing Document Type Definition (DTD):

XmlReaderSettings rs = new XmlReaderSettings();

rs.ProhibitDtd = false;

XmlReader.Create(inputUri, rs);

Regards,
Yitzhak