Showing posts with label fill. Show all posts
Showing posts with label fill. Show all posts

Tuesday, March 27, 2012

datasource wont update on delete

hi,

I have a dataadaptor which i use to fill a dataset. I can do this no problems. But if I delete a row from the dataset and update the adaptor again, nothing gets changed in my source database. Does anyone know why this is?

here's my code for my dataadaptor:
SqlConnection conn = new SqlConnection(connectionString);
SqlDataAdapter adapter = new SqlDataAdapter();
adapter.SelectCommand = new SqlCommand("select * from tblExtRef", conn);
adapter.SelectCommand.Connection = conn;

SqlParameter parm;
SqlCommand cmd;
cmd = new SqlCommand("DELETE FROM tblextref WHERE extrefid = @.extrefid",conn);
parm = cmd.Parameters.Add("@.extrefid", SqlDbType.Int , 40, "extrefid");
parm.SourceColumn = "ExtRefid";
//parm.SourceVersion = DataRowVersion.Original;
//parm.Direction = ParameterDirection.InputOutput;
//SourceVersion = DataRowVersion.Original;
adapter.DeleteCommand = cmd;if you delete a row from the dataset/datatable, you just run the update on the adapter.

I don't think you need to create a delete command manually.

Sunday, March 11, 2012

Datagrids

Having populated my datagrid with the following code,

DA = New SqlCeDataAdapter(SqlceCmd)
MyData = New DataTable
DA.Fill(MyData)
MyData.Columns(0).ColumnName = "Task"
MyData.Columns(1).ColumnName = "Reported"

IncidentDtl.DataSource = MyData
IncidentDtl.Refresh()

I now want to change the size of the columns. Could someone please let me know how to manipulate the appearance of my grid as my grid IncidentDtl doesn't seem to have a Columns property only the Table does.

I would take this thread to one of the Visual Studio or Visual Basic (or even C#) forums. Many of these SQL Server folks don't have much experience with the inner workings of the DataGridView control.

The DataGridView has any number of properties like the AutoSizeColumnsMode that can automatically set the size of the columns based on the first row width, the displayed rows maximum width etc.

|||

What about:

Code Snippet

DataGridView dgw = new DataGridView();

dgw.Columns["SomeColumn"].Width = 100;

Jens K. Suessmeyer.

http://www.sqlserver2005.de

|||

Ah, that would be nice, but the Columns collection.Width property is read-only.

|||http://msdn2.microsoft.com/en-us/library/system.windows.forms.datagridviewcolumn.width.aspx

DataGridViewColumn.Width Property

Gets or sets the current width of the column.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

Jens K. Suessmeyer

http://www.sqlserver2005.de

Datagrids

Having populated my datagrid with the following code,

DA = New SqlCeDataAdapter(SqlceCmd)
MyData = New DataTable
DA.Fill(MyData)
MyData.Columns(0).ColumnName = "Task"
MyData.Columns(1).ColumnName = "Reported"

IncidentDtl.DataSource = MyData
IncidentDtl.Refresh()

I now want to change the size of the columns. Could someone please let me know how to manipulate the appearance of my grid as my grid IncidentDtl doesn't seem to have a Columns property only the Table does.

I would take this thread to one of the Visual Studio or Visual Basic (or even C#) forums. Many of these SQL Server folks don't have much experience with the inner workings of the DataGridView control.

The DataGridView has any number of properties like the AutoSizeColumnsMode that can automatically set the size of the columns based on the first row width, the displayed rows maximum width etc.

|||

What about:

Code Snippet

DataGridView dgw = new DataGridView();

dgw.Columns["SomeColumn"].Width = 100;

Jens K. Suessmeyer.

http://www.sqlserver2005.de

|||

Ah, that would be nice, but the Columns collection.Width property is read-only.

|||http://msdn2.microsoft.com/en-us/library/system.windows.forms.datagridviewcolumn.width.aspx

DataGridViewColumn.Width Property

Gets or sets the current width of the column.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

Jens K. Suessmeyer

http://www.sqlserver2005.de

Thursday, March 8, 2012

datafile usage

If a database consists of more than one datafile, how does SQL Server use the space in these datafiles ?, does it fill up the first one then move to the next and so forth, or does it use up pages across all the files evenly ?.In a group, the files are all filled proportionnally to their size.

For example : a group with file1 = 100 MB and file2 = 200 MB
If you add 3 MB, 1 MB is added to file1, and 2 MB to file2.|||Thanks for the information|||You're welcome ! :)

Friday, February 24, 2012

database's default fill factor?

>>Shows the fill factor that specifies how full each index page can be. If a
Hi, what's database's default factor?0 or 100%. Can be configured for all databases using sp_configure. For
more information see fill factor option in the SQL Server BOL.
HTH
J
"js" <js@.someone@.hotmail.com> wrote in message
news:elVVFmUYFHA.3132@.TK2MSFTNGP09.phx.gbl...
> Hi, what's database's default factor?
>|||Thanks Jerry,
When adding index, what is the factor to specify?
CREATE NONCLUSTERED INDEX IX_Commission ON dbo.Commission
(
UID
) ON [PRIMARY]
GO
"Jerry Spivey" <jspivey@.vestas-awt.com> wrote in message
news:OSRSeoUYFHA.2348@.TK2MSFTNGP14.phx.gbl...
>0 or 100%. Can be configured for all databases using sp_configure. For
>more information see fill factor option in the SQL Server BOL.
> HTH
> J
> "js" <js@.someone@.hotmail.com> wrote in message
> news:elVVFmUYFHA.3132@.TK2MSFTNGP09.phx.gbl...
>|||The answer is "it depends". A lower fillfactor reduces fragmentation of the
index and a higher fillfactor reduces the size of the index. As a general
rule more read activity = higher fillfactor more write activity = lower
fillfactor.
"js" <js@.someone@.hotmail.com> wrote in message
news:uJ8GstUYFHA.4036@.tk2msftngp13.phx.gbl...
> Thanks Jerry,
> When adding index, what is the factor to specify?
> CREATE NONCLUSTERED INDEX IX_Commission ON dbo.Commission
> (
> UID
> ) ON [PRIMARY]
> GO
>
> "Jerry Spivey" <jspivey@.vestas-awt.com> wrote in message
> news:OSRSeoUYFHA.2348@.TK2MSFTNGP14.phx.gbl...
>|||Usually, the default fill factor value is appropriate for the majority of
indexes. You might find the topic 'Fill Factor' in SQL Server Books Online
useful for a general understanding of how fill factor is used.
Gail Erickson [MS]
SQL Server Documentation Team
This posting is provided "AS IS" with no warranties, and confers no rights
"js" <js@.someone@.hotmail.com> wrote in message
news:uJ8GstUYFHA.4036@.tk2msftngp13.phx.gbl...
> Thanks Jerry,
> When adding index, what is the factor to specify?
> CREATE NONCLUSTERED INDEX IX_Commission ON dbo.Commission
> (
> UID
> ) ON [PRIMARY]
> GO
>
> "Jerry Spivey" <jspivey@.vestas-awt.com> wrote in message
> news:OSRSeoUYFHA.2348@.TK2MSFTNGP14.phx.gbl...
>