Showing posts with label field. Show all posts
Showing posts with label field. Show all posts

Sunday, March 25, 2012

accessing datasets / Field collections through custom code

Hi,

My report has multiple datasets, and I want to access the fields of a particular dataset from custom code. The problem is that the name of the dataset to use is only calculated during the execution of the custom code.

Allow me to illustrate:

public function Test(data as DataSets, fieldName as string)

dim datasetName as string = CalculateDatasetName()
dim ds as Dataset = data(datasetName)

' now here I want to get the fieldName out of the dataset.
' in the report, I would do something like
' First(Fields!fieldName.Value, datasetName)
' but in custom code, this obviously doesn't work.

end function

I've been looking for a way to accomplish this, but it seems you cannot get data from a dataset through custom code (there is only the commandtext property). Also it is not possible to pass the Fields collection as a parameter, as I do not know the dataset name when in the report designer.

I hope my problem description is clear.
Does anyone know how to solve this issue?

Thanks,
Phil

Hi Phil,

Look at the code below

public DataSet Dataset_name = new DataSet();

public DataTable DataTable_name = new DataTable();

public DataColumn DataColumn_name = new DataColumn();

public DataView View_name = new DataView();

public datatype function(name_of _variable_which catch_the column_value datatype)

{

DataColumn_name = new DataColumn("name_of _variable_which catch_the column_value", System.Type.GetType("System.String"))

}

Hope this helps

Priyank

Tuesday, March 20, 2012

Access Yes/No field equivalent in Sql Server

Hi,
I am building a table in sql server. One of the field is equivalent to
Access yes/no field. This will have values Yes or No obtained from a form in
Asp page. I am wonering what would be the correct datatype for this field.
Thanks.char(1) - "y" or "n"
varchar(3) - "yes" or "no"
"Jack" <Jack@.discussions.microsoft.com> wrote in message
news:EAF7A165-2386-442D-881C-775B3C161473@.microsoft.com...
> Hi,
> I am building a table in sql server. One of the field is equivalent to
> Access yes/no field. This will have values Yes or No obtained from a form
> in
> Asp page. I am wonering what would be the correct datatype for this field.
> Thanks.|||Jack,
You could use a bit datatype with support for 0 or 1 then translate that to
Yes or No in code. You could also use a char(3) with a check contraint
limiting the valid entries to Yes/No. A default constratint can be added as
well for a default of Yes or No when a user does not explicitly enter a
value.
HTH
Jerry
"Jack" <Jack@.discussions.microsoft.com> wrote in message
news:EAF7A165-2386-442D-881C-775B3C161473@.microsoft.com...
> Hi,
> I am building a table in sql server. One of the field is equivalent to
> Access yes/no field. This will have values Yes or No obtained from a form
> in
> Asp page. I am wonering what would be the correct datatype for this field.
> Thanks.|||You may consider using Bit for boolean data type in Presentation layer.
Perayu
"Jack" <Jack@.discussions.microsoft.com> wrote in message
news:EAF7A165-2386-442D-881C-775B3C161473@.microsoft.com...
> Hi,
> I am building a table in sql server. One of the field is equivalent to
> Access yes/no field. This will have values Yes or No obtained from a form
> in
> Asp page. I am wonering what would be the correct datatype for this field.
> Thanks.|||Thanks for all the help from Raymond, Jerry and Perayu. I appreciate it.
"Perayu" wrote:

> You may consider using Bit for boolean data type in Presentation layer.
> Perayu
> "Jack" <Jack@.discussions.microsoft.com> wrote in message
> news:EAF7A165-2386-442D-881C-775B3C161473@.microsoft.com...
>
>

Thursday, March 8, 2012

Access to SQL Server Express

Hi - is it possible to transfer an access database to SQL Server 2005
Express, while maintaining the primary/auto increment field numbers?
I've tried the upsizing wizard, and this didn't maintain indexes/keys,
I've also tried the new SQL Server Migration Assistant for Access CTP2 -
while this kept the column integrity intact, it appears to have
recreated the primary key, so where my autoincrement field in access may
have had:
1 toyota
2 citroen
3 vw
6 ford
8 audi
..after migration, the table is recreated as...
1 toyota
2 citroen
3 vw
4 ford
5 audi
..meaning the relationships between the tables are not maintained.
I have perhaps misunderstood what the migration tool is supposed to do,
but if anyone can help advise what tool will do what I'm looking for,
I'd appreciate it.
Thanks, Mark
*** Sent via Developersdex http://www.developersdex.com ***I haven't tried the ctp Migration Assistant, but there 'should' be an option
that allows the import of IDENTITY values.
--
Arnie Rowland*
"To be successful, your heart must accompany your knowledge."
"Mark" <anonymous@.devdex.com> wrote in message
news:u7YVVnOpGHA.2360@.TK2MSFTNGP05.phx.gbl...
> Hi - is it possible to transfer an access database to SQL Server 2005
> Express, while maintaining the primary/auto increment field numbers?
> I've tried the upsizing wizard, and this didn't maintain indexes/keys,
> I've also tried the new SQL Server Migration Assistant for Access CTP2 -
> while this kept the column integrity intact, it appears to have
> recreated the primary key, so where my autoincrement field in access may
> have had:
> 1 toyota
> 2 citroen
> 3 vw
> 6 ford
> 8 audi
> ..after migration, the table is recreated as...
> 1 toyota
> 2 citroen
> 3 vw
> 4 ford
> 5 audi
> ..meaning the relationships between the tables are not maintained.
> I have perhaps misunderstood what the migration tool is supposed to do,
> but if anyone can help advise what tool will do what I'm looking for,
> I'd appreciate it.
> Thanks, Mark
>
> *** Sent via Developersdex http://www.developersdex.com ***

Access to SQL Server Express

Hi - is it possible to transfer an access database to SQL Server 2005
Express, while maintaining the primary/auto increment field numbers?
I've tried the upsizing wizard, and this didn't maintain indexes/keys,
I've also tried the new SQL Server Migration Assistant for Access CTP2 -
while this kept the column integrity intact, it appears to have
recreated the primary key, so where my autoincrement field in access may
have had:
1 toyota
2 citroen
3 vw
6 ford
8 audi
..after migration, the table is recreated as...
1 toyota
2 citroen
3 vw
4 ford
5 audi
..meaning the relationships between the tables are not maintained.
I have perhaps misunderstood what the migration tool is supposed to do,
but if anyone can help advise what tool will do what I'm looking for,
I'd appreciate it.
Thanks, Mark
*** Sent via Developersdex http://www.codecomments.com ***I haven't tried the ctp Migration Assistant, but there 'should' be an option
that allows the import of IDENTITY values.
Arnie Rowland*
"To be successful, your heart must accompany your knowledge."
"Mark" <anonymous@.devdex.com> wrote in message
news:u7YVVnOpGHA.2360@.TK2MSFTNGP05.phx.gbl...
> Hi - is it possible to transfer an access database to SQL Server 2005
> Express, while maintaining the primary/auto increment field numbers?
> I've tried the upsizing wizard, and this didn't maintain indexes/keys,
> I've also tried the new SQL Server Migration Assistant for Access CTP2 -
> while this kept the column integrity intact, it appears to have
> recreated the primary key, so where my autoincrement field in access may
> have had:
> 1 toyota
> 2 citroen
> 3 vw
> 6 ford
> 8 audi
> ..after migration, the table is recreated as...
> 1 toyota
> 2 citroen
> 3 vw
> 4 ford
> 5 audi
> ..meaning the relationships between the tables are not maintained.
> I have perhaps misunderstood what the migration tool is supposed to do,
> but if anyone can help advise what tool will do what I'm looking for,
> I'd appreciate it.
> Thanks, Mark
>
> *** Sent via Developersdex http://www.codecomments.com ***

Tuesday, March 6, 2012

Access to group field value from the child element

I have a matrix and have a column groups on month and products ( I have only
4 products) and am showing the number of products sold in that month. What I
need is to show instead of number products, I need to show the % of sales for
that product as compared to all sales.
I need to access the group total in the child field. If 10 items were sold
in each product, I would like to show 25% (10/40 * 100) in the detail. Is
there any way to access the group total in the child fields.
Any help is appreciated.
--
Thanks
RK BalajiI found the solution.. I just have to use the scope parameter in the count
function to get the value. Thanks.
"RK Balaji" wrote:
> I have a matrix and have a column groups on month and products ( I have only
> 4 products) and am showing the number of products sold in that month. What I
> need is to show instead of number products, I need to show the % of sales for
> that product as compared to all sales.
> I need to access the group total in the child field. If 10 items were sold
> in each product, I would like to show 25% (10/40 * 100) in the detail. Is
> there any way to access the group total in the child fields.
> Any help is appreciated.
> --
> Thanks
> RK Balaji

Access Text Within A SQL Binary Field

Is there any way to access the text within a SQL Binary object? For example
if I wanted to count the number of words within a Word document that had bee
n
added to a binary field in the database.
I figure the IFilters used by the Full-Text indexing service must do
something like this in order to create it's keyword index database.Look for: textptr, readtext, writetext, updatetext, textvalid and
sp_invalidate_textptr in the BOL.
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: http://cerbermail.com/?QugbLEWINF
"Anthony" <Anthony@.discussions.microsoft.com> wrote in message
news:3CFF2482-3A52-40E1-B629-3873ACAEDC41@.microsoft.com...
> Is there any way to access the text within a SQL Binary object? For
> example
> if I wanted to count the number of words within a Word document that had
> been
> added to a binary field in the database.
> I figure the IFilters used by the Full-Text indexing service must do
> something like this in order to create it's keyword index database.|||Anthony,
Out-of-the box with either SQL Server 2000 or SQL Server 2005 (Yukon) this
is not possible. You would need to either parse the text of the MS Word
documents before you inserted the documents into an IMAGE datatype or write
your own IFilter *wrapper* to capture the text into a separate text based
column. The MSDN Platform SDK has code examples and utilities that can be
used to the later, if you want to do this.
Yes, you are correct, that is what the IFilters (Microsoft's and 3rd party)
do.
Regards,
John
--
SQL Full Text Search Blog
http://spaces.msn.com/members/jtkane/
"Anthony" <Anthony@.discussions.microsoft.com> wrote in message
news:3CFF2482-3A52-40E1-B629-3873ACAEDC41@.microsoft.com...
> Is there any way to access the text within a SQL Binary object? For
> example
> if I wanted to count the number of words within a Word document that had
> been
> added to a binary field in the database.
> I figure the IFilters used by the Full-Text indexing service must do
> something like this in order to create it's keyword index database.

Sunday, February 19, 2012

Access Memo field to SQL Server Text field

Hi,

I'm importing an Access database to SQL Server 2000.
The issue I ran into is pretty frustrating... All Memo fields that get copied over (as Text fields) appear to be fine and visible in SQL Server Enterprise Manager... except when I display them on the web via ASP - everything is blank (no content at all).

I didn't have that problem with Access, so I ruled out the possibility that there's something wrong with the original data.

Is this some sort of an encoding problem that arose during database import?
I would appreciate any pointers.If the data is visible within SQL Server, but not from your ASP page, then the problem is with your ASP page and the way it is pulling the text data.
Do you really need this to be a text field? The varchar datatype will handle up to 8000 bytes.|||That's a good point - I might be able to get away with varchar. It's something I'll look into, but I'm still curious as to why the data behaves this way (I ran into similar problems in the past while trying to import Access data to SQL server).

My ASP page is functioning properly. I use a simple "SELECT *" statement to pull the data and display it on the page. With an Access DSN it encounters no problems and shows all the data as intended. When I import the data into SQL Server and swap the DSN to point to the newly-created database (while not modifying the ASP page itself in any way) the text fields display no content.|||A text field in SQL Server is not stored within the record. The record actually only stores a pointer to the location of the actual data. This may be why your page is not handling it properly, but I don't know the work-around. You could try posting your question on the ASP forum.|||Interesting... I was aware that Text fields are stored differently and separately from the regular data in the database, but I didn't think it would affect the way they're displayed through the recordset...

Maybe there's something that can be done on the ASP side - I'll ask some ASP guys.

Thanks.|||Interesting... I was aware that Text fields are stored differently and separately from the regular data in the database, but I didn't think it would affect the way they're displayed through the recordset...I wouldn't have thought so either, but it is my best guess.
What happens in your ASP code if you enumerate the column names rather than using "select *" (which is a bad practice anyway)?|||I use a simple "SELECT *" statement to pull the data and display it on the page.

ahhhhhhhhhhhhhhhhhhhhhhhhhhh

http://weblogs.sqlteam.com/brettk/archive/2004/04/22/1272.aspx|||I try to do it properly with larger systems and database, but, yeah, for me it's laziness that makes me use "Select *"...|||I try to do it properly with larger systems and database, but, yeah, for me it's laziness that makes me use "Select *"...

Hey! No one's lazier than me....

SELECT ', ' + COLUMN_NAME FROM INFORMATION_SCHEMA.Columns
WHERE TABLE_NAME = 'xxx'
ORDER BY ORDINAL_POSITION

SELECT * can buy you a boatload of trouble...so it's amatter how you want to spend your laziness...you have no choice when you have exploding code|||I wouldn't have thought so either, but it is my best guess.
What happens in your ASP code if you enumerate the column names rather than using "select *" (which is a bad practice anyway)?

Well, that's an interesting question, mostly because it gives me some sort of a deja vu feeling - as if I encountered something like this several years ago...
It's possible that I did something like this in the past and fixed the problem that way.
I'll check into this on Thursday when I'm back at work.

Thanks.|||You are off UNTIL Thursday?

Okay, but this Thursday is Turkey Day for us Yanks, so you'll have to depend upon the Pootle Flumps and Cannucks of the world to help you out.|||Hey! No one's lazier than me....

SELECT ', ' + COLUMN_NAME FROM INFORMATION_SCHEMA.Columns
WHERE TABLE_NAME = 'xxx'
ORDER BY ORDINAL_POSITION

SELECT * can buy you a boatload of trouble...so it's amatter how you want to spend your laziness...you have no choice when you have exploding code

That's an interesting way to structure a query - I've never done it this way before.

Dare to dream... Sorry, you think that you're the laziness champ, but you're not. Your laziness doesn't compare to mine - not even close.|||You are off UNTIL Thursday?

Okay, but this Thursday is Turkey Day for us Yanks, so you'll have to depend upon the Pootle Flumps and Cannucks of the world to help you out.

Yes, it sounds a bit odd. I'm actually at work as we speak, but I also have another part time job as a contractor with my previous employer. Thanksgiving will be a good time to come in and get a bunch of work out of the way.|||See but here's the rub, my laziness is born out of economy of effort..the smarter you work, the less you have to

some laziness makes your life more simple, other types make your life much more difficult, you have to decide|||See but here's the rub, my laziness is born out of economy of effort..the smarter you work, the less you have to

some laziness makes your life more simple, other types make your life much more difficult, you have to decide

Agree. Mine usually gets me in trouble somewhere down the line.

... but it still feels good to be the "Champ" :)

Monday, February 13, 2012

Access help.

I am a beginning programmar using Access. I need help defining creating a query that shows the number of items from a particular field as there are many of the same items. As well as create seperate listings for each item as they are also located under different location keys. Can anyone help???

This question sounds pretty basic and I feel really dumb for asking.Look at the following 2 functions: count(*) and group by

col has values 1,3,6,1,2,1,1,3

e.g. - select col, count(*) from table group by col

would return:

col count(*)
1 4
2 1
3 2
6 1|||does the same rule apply when you are trying to sort 2 columns by count.

ex.

col 1 - High School 1, high school 2 high school 3
col 2- IIe, IIe, iMac, II, HP HP, IIe, IIe, iMac, II, HP HP
col 3 - count

I am trying to create a count list for: high school 1, 2 and 3.

Jeremy

Originally posted by rnealejr
Look at the following 2 functions: count(*) and group by

col has values 1,3,6,1,2,1,1,3

e.g. - select col, count(*) from table group by col

would return:

col count(*)
1 4
2 1
3 2
6 1

Sunday, February 12, 2012

Access Formula values at runtime

How can i retrive value of a formula field or any other field in code at runtime, which can be used in code 4r further operations.

e.g :I have a formula field which calculates a Value Discrepancy.I have to show a message box Message Box based on its value from the code.
I am using CR for VS2005


Thankyou
ShauryaFinally i found the solution to my problem so i am sharing the solution here.

The values that are printed on the report can be accessed from the code by this code.

CrystalDecisions.CrystalReports.Engine.ReportDocument a = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

string value=a.Rows[0][20].ToString();

The Rows property contains the data on the front page of the report.|||how did you get this CrystalDecisions.

Any reference to add to repor to get it.

Amarjit

Saturday, February 11, 2012

Access fields in the Fields collection by index

Is there anyway to access the fields collection using an index?
e.g,. =Fileds(0).Value ?
I want to create a calculated field based on two columns (position 1 and 2)
in a matrix report, but their column names change based on the dates as
paramaters.
Any ideas?On May 3, 11:06 am, Eric <E...@.discussions.microsoft.com> wrote:
> Is there anyway to access the fields collection using an index?
> e.g,. =Fileds(0).Value ?
> I want to create a calculated field based on two columns (position 1 and 2)
> in a matrix report, but their column names change based on the dates as
> paramaters.
> Any ideas?
You should be able to access the position 1 column via: =Min(Fields!
FieldThatIsPivoted.Value). The second positioned column will be tricky
to capture though. Otherwise, you should be able to handle this in the
query/stored procedure that sources the report (via while loop or
cursor). Hope this helps.
Regards,
Enrique Martinez
Sr. Software Consultant