Showing posts with label appears. Show all posts
Showing posts with label appears. Show all posts

Tuesday, March 20, 2012

ASP 2.0 sql syntax change?

I was simply trying to create a sql command using ASP 2.0 but the syntax appears to have changed. I was trying to write the following:

SqlCommand

cmdUpdateData =newSqlCommand("AddMessage", myConnection);

cmdUpdateData.CommandType = CommandType.StoredProcedure;

But, intellisence will not offer me the second 'CommandType' on the second line?? It works fine using ASP 1.1 but not here on 2.0

Can anyone please help?

Looks ok to me. Are you importing system.data and system.data.sqlclient?|||

Yes I was lacking the system.data namespace!

Many thanks,

James

|||

That all works fine now, but a little further down my code where I fill the datagrid I have another problem with the changing sysntax.

In visual studio 2003 I would use the following:

try

{

//first open the connection

myConnection.Open();

//fill data set with data from sql data adapter

myAdapter.Fill(ds);

//bind the data grid to the datasetthis.dgdShowStudents.DataSource=ds;this.dgdShowStudents.DataKeyField="StudentId";this.dgdShowStudents.DataBind();

However, using ASP2.0 intellisence does not pick up on DataKeyField. Should I be using something else? or do I have to use the wizard for filling a grid. I'd rather do it with code?

|||Is it a datagrid or a gridview?|||GridView. I assumed it would take the same code as the DataGrid|||

If you are using the gridview, I would normally bind it to a sqldatasource control instead of using code. It's a lot simplier and it handles some things very nicely for you (Sortable columns, caching, etc).

The gridview is similiar, but not the same as a datagrid. As for the datakeys, the gridview supports multiple column binding, which I don't believe the datagrid did. I believe the property you are looking for is called DataKeyNames for the gridview.

|||

Many thanks for the help,

James

Thursday, March 8, 2012

AS2005 calculations bug?

This problem appears in BI-Developer Studio SP1 on a Windows 2003 Terminal server session. It appeared when I switched from the list view to the script/code view.

The calculations tab is empty with only this error message:

"Unexpected error occurred. Length cannot be less than zero. Parmeter name:length"

I am unable to see the calculations in the script view and in the list view. It is possible to see the calculations in the xml file if I choose code view.

Anyone who have seen this before?

Regards

Thomas Ivarsson

Problem solved. I had some rolling last 12 months calculations in a cube with only a few months of data that I tried to set to null and commented out all MDX-code. The purpose was to activate these calculations later. After removing null and activating the MDX-code everything works fine.

I think however that this is a minor bug.

Regards

Thomas Ivarsson