3rd Tier data not displaying in Data Adapter Preview

dotnet framework

    Next

  • 1. Resizing an Image to fit in a PictureBox
    I have a question about how to format the display of a JPEG image in a PictureBox control. My current code is the fullowing.... Image image = Image.FromFile( strFileName ); pictureBox.SizeMode = PictureBoxSizeMode.StretchImage; pictureBox.Image = image; The images are loaded dynamically, and I do not have control of the size and aspect ratio of the images. With the StretchImage mode selected, I get some strange stretching (either vertically or horizontally, when the aspect ratio of the image is noticably different from the aspect ratio of the PictureBox.) What mechanism can I use to effectively resize the image myself before displaying it in the PictureBox? As yet I'm unable to find either a method on the Image class or on the PictureBox class to resize the image before display. I'd like to be able to adjust it to either fit snug vertically or horizontally depending on respective aspect ratios. Thanks, and Cheers, -- Bruce
  • 2. Dynamic Label Resizing
    Hi, I have a Form that acts as a questionaire with Label controls and corresponding TextBox controls for the responses. The problem is that the questions are dynamic and can contain 20-500 characters. I would like to set a fixed width, and then resize the label height-wise to accomodate extra characters. I would then place the textbox at the bottom right of the control. Is this possible? I looked at the PreferredHeight property of the label, but it kept re-sizing to 16px. Autosize works for the width only, unless I am missing something. Thanks, Dave
  • 3. Setting Splitter Position
    I don't understand why, but during form load, I'm loading in stored values and trying to set the splitter position: private void MainForm_Load(object sender, System.EventArgs e) { settings = LoadSettings(); splitter1.SplitPosition = settings.posSplitter; } But, the splitter position never changes from 25. Even when the splitter is positioned in the forms editor, it set to 25. One interesting thing, tho, is that if I set the position using a menu command it works just fine. Anyone have any ideas why? Thanks! Gene

3rd Tier data not displaying in Data Adapter Preview

Postby V2hpc2t5Um9tZW8 » Wed, 22 Jun 2005 04:49:05 GMT

I have a dataset consisting of 3 tables:  tableA is the parent of tblB who is 
the parent of tblC.  They each have a SQL data adapter that fills them with 
the correct data.  However, I cannot get the data from tblC to display in the 
ultrawingrid.  For reasons I explain in the 3rd para. below, this appears not 
to be an issue with the grid.

In design the grid shows each band correctly.  When I run the form and fill 
the grid, I get no complaint of failing to enable the constraints.  Bands 0 & 
1 show data but Band 2 does not.

When I preview the data using the data adapters, I fill each data table in 
the correct order, and, again, I get no errors and the data in tableC shows 
up.  In the Data tables list of the Data Adapter Preview window, I can click 
on each table and see the data in them.  An alternate way to view the data in 
child tables, is to click on the + in each row of the parent table which will 
show the relationship link.  Clicking on the link shows the related rows in 
the child table.  This work fine for tableA; however, for tableB clicking on 
the link shows no rows from tableC even though clicking on tableC shows 
there is data there.


(PkgID is the PK of tableA)

(PkgID, MktName, ProdLab, ProdSTD is PK of tableB)
(the relationship from tableA to tableB is PkgID (PK) PkgID (FK))

(PkgID, MktName, ProdLab, ProdSTD, ModID is PK of tableC)
(for the relationship between tableB and tableC -- each of the 1st four 
columns are mapped to the corresponding column in tableC)

For each relationship, reate foreign key constraint onlyis not checked 
and all the values for the rules are set to default.

Here are examples of actual data in order of tableA, tableB, tableC:

PkgID  -- PkgName 
95 AGRAD-BW

PkgID MktName ProdLab rodSTD Qty DivideQty 
95 GRAD 5x7 20 2 1 

PkgID MktName ProdLab rodSTD ModID
95-GRAD- 5x7-20-BW

If anyone sees any problem with this, your help is appreciated.

WR

Similar Threads:

1.adapter preview-data succeeds, but ASPX page says 'Cannot open database'

I'm trying to write an ASPX page that uses an OleDbDataAdapter to get
data from a SQL Server database.  When I test the connection, it
returns success, and when I preview the data using the Adapter's
"preview data" right-click option, it works, but when I load the actual
page, I get the error "Cannot open database requested in login
'cookiecutter'. Login fails."

It seems to work when I use a pre-existing database like Northwind or
Portal, but not when I try creating a new one.  But it looks like I'm
creating them correctly.  Here are the exact steps:

1) In Visual Studio 2003 I go to Server Explorer, right-click "Data
Connections" and pick "Create new SQL Server database".  I specify
BENNETTS_3_2002\NetSDK as the server name and "cookiecutter" as the new
database name.  I select "Use Windows NT Integrated Security" as well.

2) The connection now appears, as expected, under Data Connections.  If
I open its properties it shows BENNETTS_3_2002\NetSDK as the server
name, Use Windows NT Integrated Security is selected, and
"cookiecutter" is listed as the database to select.  If I click "Test
Connection" it returns success.

3) In the ASP.Net project, I drop a new instance of an OleDbDataAdapter
onto a Web form, specify BENNETTS_3_2002\NetSDK.cookiecutter.dbo as the
data connection, and specify "SELECT wbuser.* FROM wbuser" as the
select command, the adapter gets created successfully.  If I
right-click the adapter and click "Preview Data" I can see the contents
of the wbuser table being loaded.

4) BUT now if I put some code in the codebehind page like
DataSet objDataSet = new DataSet();
this.oleDbDataAdapter1.Fill(objDataSet);

when I actually try loading the page in the browser, I get the error
"Cannot open database requested in login 'cookiecutter'. Login fails."

Any idea what could cause this, if test-connection and preview-data
were reporting success?  Could it have something to do with how I'm
creating the new database?  Because if I go through the same steps
above but use a pre-existing database like Northwind or Portal, it
works.  It only fails for the new databases I create.  But I thought I
was creating them correctly, choosing "Use Windows NT Integrated
Security".

Help much appreciated, thanks!

-Bennett

2.Table Adapter - Preview Data - Null Args

How do you set a Stored Procedure's Parameter value to NULL in the
Preview Data Dialog of the Data Set Designers?

(Right Clicking on a TableAdpater configured for SPs will bring the
dialog up.)

3.How do I drop/auto configure my data adapters in my dos Middle-Tier project/app

Hi..
How do I drag&drop thus: auto configure with the wizard (or similar) the data adapters (i.e. mapped tables in my SQL Svr DB) that I need to be exposed in my non-windows Middle-Tier project/app
Yes, it easy to do this in a windows app.  But how does it get done in a non-windows app.  Currently I am having to code it by hand which is rather time consuming etc
In most code examples I have seen, SP's are used for the middle-tier, unfortunetly the requirements in my app do not allow (or it is not suggested) for SP's. Thus i need the functionality and ease-of use of multiple, dedicated and mapped data adapters in the Mid-Tier
Is there an easy way to do this. I was once told it is possible, but there is a trick to it
Please.... Wot is that Trick???

4.Data Adapters, Data Sets, Data TableMappings, and XML

Here's what I'm trying to do:

1. Create a data adapter with Select and Insert commands.

2. Use DataTableMappings to map XML tags into columns in a 
data base table.

3. Create a dataset

3. Read in a schema using dataset.ReadXmLSchema

4. Read in an xml file that contains the data using 
dataset.Read XML

5. Add 3 new columns to the dataset. (These columns have 
already been mapped in step 2).

6. Put data in the 3 new columns.

7. Modify some data in the other columns using xpath 
queries to find the nodes that need changing.

8. Use datadapter.update(dataset, tablename)

Everything seems to work fine until step 8. I get all the 
data, the extra columns get added, and the data in other 
columns gets modified. When I execute step 8 I get:

Run-time exception thrown : 
System.InvalidOperationException - Cannot add or remove 
columns from the table once the DataSet is mapped to a 
loaded XML document.

Any ideas about how I can either fix this or do it another 
way.

TIA,
Candi

5.problem with data adapter and data set while inserting and retrieving data

i am using a data adapter and a dataset for filling and retrieving data
into .mdb database.
following is the code.....

for the form load event
  Dim dc(0) As DataColumn
        Try
            If OleDbConnection1.State = ConnectionState.Closed Then
                OleDbConnection1.Open()
            Else
                MsgBox("connection can not be established")
            End If
            DA.Fill(DataSet11, "Table1")
            cmd = New OleDbCommandBuilder(DA)
            dc(0) = DataSet11.Tables("Table1").Columns("EmpID")
            DataSet11.Tables("Table1").PrimaryKey = dc
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
        Delete.Enabled = False
    End Sub

for  inserting values into the DB

Private Sub Insert_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Insert.Click
        Dim dr As DataRow
        dr = DataSet11.Tables("Table1").NewRow
        dr.Item(0) = Val(TB1.Text)
        dr.Item(1) = TB2.Text
        dr.Item(2) = TB3.Text
        dr.Item(3) = Val(TB4.Text)
        dr.Item(4) = TB5.Text
        DataSet11.Tables("Table1").Rows.Add(dr)
        DA.Update(DataSet11, "Table1")
        MsgBox("data is saved")
        rno = 0
        call filldata()

filldata function consists of the following

 With DataSet11.Tables("Table1").Rows(rno)
         TB1.Text = Trim(.Item(0))
         TB2.Text = Trim(.Item(1))
         TB3.Text = Trim(.Item(2))
         TB5.Text = Trim(.Item(4))
         End With

the error it gives is " there is no row at
0........system.nullreference...........i checked the connection and
its working fine and also the database is getting accessed........the
error is occuring at the line " With
DataSet11.Tables("Table1").Rows(rno) "

6. datagrid not displaying data table data

7. Data->Generate Dataset|Preview Data



Return to dotnet framework

 

Who is online

Users browsing this forum: No registered users and 98 guest