How do I mark a DataTable as read-only
I want to return a read-only DataTable so that I can cache it. Is it
possible?
Alternate suggestions (that don't waste tonnes of memory)?
Thanks,
Philippe Tag: Xml Schema Relations Tag: 89929
connection in connection pool with pooling=false
I'm finding that even when pooling=false, a connection remains in my
connection pool connected to my database (it seems to quite quickly timeout
though - say 30 seconds).
My connection string:
Initial Catalog=Benji_UnitTest;Data Source=.;Integrated
Security=SSPI;Pooling=false
Using this setting, I would expect that a new connection be created
everytime, and that when the SqlConnection is close()'d (i.e., returned to
the "pool") that the underlying database connection would be closed.
I also tried setting ";Connection Lifetime=1" in order to get the connection
to close quickly (as a worksround); this didn't seem to affect any change.
Am I misunderstanding something?
Thanks,
j Tag: Xml Schema Relations Tag: 89919
Arjen Jongeling, een oude bekende
Hoewel, Arjen Jongeling is hier nog nooit geweest en ik denk dat Arjen Jongeling hier ook nooit meer zal terugkomen. Sterker nog, Arjen Jongeling zit hier helemaal fout. Maar ja, het doet het goed in de Google archieven. Tag: Xml Schema Relations Tag: 89918
how to delete a connection pool?
Is there a way that a connection pool can be explicitly deleted? E.g., using
the connection string, call some method that will close all the connections
in the pool?
Is there anyway to achieve this?
j Tag: Xml Schema Relations Tag: 89917
sql data reader issue.
I have the following code:
Public Sub SelectAdminUserByID()
Try
Dim oDR As SqlDataReader =
oData.ExecuteReader(sConnectionString, CommandType.StoredProcedure,
"spSelectAdminUserByID")
'If oDR.HasRows Then
Do While oDR.Read()
Username = CType(oDR.Item("Username"), String)
Password = CType(oDR.Item("Password"), String)
Active = CType(oDR.Item("Active"), Boolean)
Loop
'End If
oDR.Close()
oDR = Nothing
oData = Nothing
Catch ex As Exception
End Try
End Sub
I am getting a "Object reference not set to an instance of an object."
error. It is bombing on the first reference to oDR. Can someone
please point out the problem here.
Thanks Tag: Xml Schema Relations Tag: 89912
leaf rowstate unchanged on DataAdapter.update
Hello everybody
when I use the update method of a DataAdapter all added rowstates get
change. How can I make the DataAdapter let the rowstate unchanged, like the
AcceptChangesDuringFill property when filling.
Thank you
Anton Tag: Xml Schema Relations Tag: 89911
Batch Datatable Updates
Hi all,
Further to my last post regarding batch datatable updates, it seems that
loaddatarow ignores rows that are not in the "unchanged" state.
Whats the best way of dealing with this? I need to be able to add rows that
I dont know in advance whether they exist or not. After updating, I need the
rowstate to be correct too, since that would be what is used to send the
updates/inserts to the database.
Do I manually select based on PK values, and then edit/add as necessary?
Does select also ignore non "unchanged" values? If so, how do I get to
these?
This seems like a useful facility so why is loaddatarow designed to ignore
added rows?
Spammy Tag: Xml Schema Relations Tag: 89910
Deadlock Handling
Hi,
I have written an application that recently, under heavy load,
encountered the deadlock. After considering the time issue, I decided
to live with them. However, I have trouble reproducing them in order
to trap and handle them properly. Could someone please tell me what's
the Number it returned in the SQLException object so that my following
exception handling code would work?
Q1: Is the Number = 1025 or 10255 for deadlock?
Q2: Is 1 second a good interval for the victim to wait before retry?
While completed = false
Try
commit transaction
success = true
Catch SQLDeadlock As SQLException
If ErrorCount < RetryCount Then
For ErrorIndex = 0 To SQLDeadlock.Errors.Count
// catch deadlock, no need to roll back for it's handled by
DB
If SQLDeadLock.Errors(ErrorIndex).Number = 10255 Then
System.Threading.Thread.Sleep(1000)
LogErrorEvent(...)
Else
// catch other sql exceptions and roll back transaction
roll back transaction
LogErrorEvent(...)
End If
Next
Else
LogErrorEvent(...)
Exit While
End If
Catch ex As Exception
MsgBox(ex.tostring)
Finally
If success Then
complete = true
dispose transaction
else
ErrorCount += 1
end if
End Try
End While
Thank you for your help.
Charlie Chang
charlies224@hotmail.com Tag: Xml Schema Relations Tag: 89909
Transaction Question
Hi,
Can someone explain to me how the transaction object works behind the
scenes? I am currently using it in my updates and it works great. I was
curious how the rollback works and the update (added, modified and deleted
rows) actually are changed at the time of call to the dataadapter or when I
commit the changes?
Thanks Tag: Xml Schema Relations Tag: 89903
Confusion regarding loaddatarow and update
Hi all,
Im using a SQLDataAdapter with custom select, update and insertqueries which
i assume work (as they are simple SQL statements).
I use this adapter to fill a table. I also add a few more columns, and set
up primary keys. I make updates to this table. I do this by queuing the data
to be added up, and then calling beginloaddata, loaddatarow per queue item,
and finally endloaddata. I then call update on the datatable to send these
updates to the database. Unfortunately Im not getting the behavior I expect.
My understanding of loaddatarow was that it uses the primary key values to
determine if a row exists to amend - if not then it creates the row instead.
However, this only seems to happen if you set the acceptchanges argument on
loaddatarow to true. If I do this, however, then the table seems to forget
which were the new/changed rows (while debugging the status of the row reads
"unchanged") and so no updates get sent.
If I set this flag to false then endloaddata throws an exception since I may
have added two rows with the same primary keys (when what I really want to
do is update a row that may have already been newly added in this batch of
loaddatarow calls, if you see what I mean).
Is my understanding of this incorrect?
Spammy Tag: Xml Schema Relations Tag: 89901
dataReader returns an error if field blank
Hey there
I know there's a simple answer to this Quesiton because I've asked it before (but I have not yet used it and have now forgotten what the answer was!) so..
I have a simple Datareader returning the value of a field from a SQL Server but if the field is blank, the application returns an error.
A piece of the code is as follows:
cmd = New SqlCommand("SELECT * FROM thisTable WHERE Email = '" & memberVariable & "'", cn)
rdr = cmd.ExecuteReader()
rdr.Read()
textField1.Text = rdr("column1")
textField2.Text = rdr("column2")
I remember the solution was something like
textField2.Text = rdr("column2") & ""
but this returns the same error.
Help! Tag: Xml Schema Relations Tag: 89880
display images from SQL server in datareader
Hi There,
I am trying to display some images from SQL Server, the image is displaying
correctly, but when I have more than one row in the table I only get one
image displayed? What am I doing wrong? is there a better way to do this?
Sean - thanks in advance
<%@ Page Language="vb" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<HTML>
<HEAD>
<title>Retrieving Image from the Sql Server</title>
<script runat=server>
Public Sub Page_Load(sender As Object, e As
EventArgs)
Dim myConnection As New
SqlConnection(ConfigurationSettings.AppSettings("ConnectionString"))
Dim myCommand As New SqlCommand("Select
ListingImage,ListingImageType from tblListings", myConnection)
Try
myConnection.Open()
Dim myDataReader as
SqlDataReader
myDataReader =
myCommand.ExecuteReader(CommandBehavior.CloseConnection)
Do While
(myDataReader.Read())
'Dim bindata() As
Byte = myDataReader.Item("ListingImage")
'Response.BinaryWrite(bindata)
Response.BinaryWrite(myDataReader.Item("ListingImage"))
'Response.BinaryWrite(myDataReader.Item("ListingImageType"))
Loop
myConnection.Close()
Response.Write("image
displayed")
Catch SQLexc As SqlException
Response.Write("Read Failed
: " & SQLexc.ToString())
End Try
End Sub
</script>
</HEAD>
<body style="font: 10pt verdana">
</body>
</HTML> Tag: Xml Schema Relations Tag: 89879
Inserting Images into SQL Server
HI There,
I am trying to insert images into SQL server with ADO.net, the images are
inserted without any problems, but on some occasions there will be no image
to insert. Can I replace the empty value with a default image to insert? or
any image residing on the file system?
Sean - Thanks in advance
intImageSize = Trim(ListImage.PostedFile.ContentLength)
strImageType = ListImage.PostedFile.ContentType
ImageStream = ListImage.PostedFile.InputStream
if Not ImageContent Is "image/gif" OR ImageContent Is "image/pjpeg" Then
Else
ImageContent = "C:\Documents and
Settings\Administrator\Desktop\kamt1bkat.jpg"
End If
'image
Dim plistingImage As New SqlParameter("@ListingImage", SqlDbType.Image)
plistingImage.Value = ImageContent
myCommand.Parameters.Add(plistingImage)
'image type
Dim plistingImageType As New SqlParameter("@ListingImageType",
SqlDbType.Nchar, 200)
plistingImageType.Value = strImageType
myCommand.Parameters.Add(plistingImageType) Tag: Xml Schema Relations Tag: 89878
Sheet names in Excel
I appreciate everyone's help with my connection string for Excel. Here's a
follow-up or two.
How do you get the sheet names from Excel if you don't know them in advance
for your SELECT statement?
Also, is there a connection string that specifies no header row? HDR=NO
causes a "No installable ISAM" error.
Thanks. Tag: Xml Schema Relations Tag: 89877
convert DbType to/from TypeCode
I can find plenty of documentation on the relation between
System.Data.DbType and System.Type e.g.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconmappingnetdataproviderdatatypestonetframeworkdatatypes.asp
Is there a method anywhere in the .NET framework that does this mapping, or
do we have to write a long switch(...) statement? Tag: Xml Schema Relations Tag: 89873
Question about collecting Access data into SQL Server
Hi!
I have made quite simple Windows Forms application using VB.NET 2003. This
application in workstations only collect data into local Access database
table (4 tables) for manufacturing tracing purposes. Access DB is in
workstations locally as a kind of buffer because network is not available
all the time. I need to collect this data of the workstations into main SQL
Server database in certain time intervals when network connections are
available. SQL Server database contains those similar kind of tables where I
need to import access data. Any succestions how to do this? I think this has
been asked many times earlier - maybe someone will give me tip, or web-link,
or sample code ...
--
Thanks in advance!
Mika Tag: Xml Schema Relations Tag: 89870
ADO.net: Error "The ConnectionString property has not been initialized. "
Dear All,
When I run an example program on the
http://www.dotnetjunkies.com/quickstart/util/srcview.aspx?path=/quickstart/aspplus/samples/webforms/data/datagrid1.src&file=VB\datagrid1.aspx&font=3
I received an error message:
"The ConnectionString property has not been initialized.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: The ConnectionString
property has not been initialized.
Source Error:
Line 11: Line 12: DataSet ds = new DataSet();Line 13:
myCommand.Fill(ds, "Authors");Line 14: Line 15:
MyDataGrid.DataSource=ds.Tables["Authors"].DefaultView;"Can you tell me
what's wrong? Thanks!
The example code is below:
======================
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<html>
<script language="VB" runat="server">
Sub Page_Load(Sender As Object, E As EventArgs)
Dim DS As DataSet
Dim MyConnection As SqlConnection
Dim MyCommand As SqlDataAdapter
MyConnection = New
SqlConnection(System.Configuration.ConfigurationSettings.AppSettings("PubsSt
ring"))
MyCommand = New SqlDataAdapter("select * from Authors",
MyConnection)
DS = new DataSet()
MyCommand.Fill(ds, "Authors")
MyDataGrid.DataSource=ds.Tables("Authors").DefaultView
MyDataGrid.DataBind()
End Sub
</script>
<body>
<h3><font face="Verdana">Simple Select to a DataGrid Control</font></h3>
<ASP:DataGrid id="MyDataGrid" runat="server"
Width="700"
BackColor="#ccccff"
BorderColor="black"
ShowFooter="false"
CellPadding=3
CellSpacing="0"
Font-Name="Verdana"
Font-Size="8pt"
HeaderStyle-BackColor="#aaaadd"
EnableViewState="false"
/>
</body>
</html> Tag: Xml Schema Relations Tag: 89869
Reading BLOB
I am getting an error while reading a BLOB from oracle 8i using OleDbDataAdapter.
can anybody tell me how to read a BLOB from oracle Tag: Xml Schema Relations Tag: 89865
OLAP Connection
Is anyone else having this problem?
I'm trying to connect to an OLAP cube using the OleDbConnection. The connection string I provided it works for other apps and the server itself has no security applied to it. But when it tries to open, it throws up an exception saying that the database does not exist. Then, when I remove "Initial Catalog" from the string, it says that it cannot connect to the cube.
Any suggestions? Tag: Xml Schema Relations Tag: 89857
Problems with OLEDbDataAdapter method Update
I run this code without error. I create a recordset of the changes, the row
I want to add, but the Update command doesn't add the records to the DB.
The Update Command returns a zero indicating that no records change. I'm
lost does anyone have any ideas?
'Open Appropriate VAR Table
strSql = "Select * FROM [" + CStr(dcSheetName.ColumnName) + "]
ORDER BY [Date];"
dsVarTables = CreateDataSet(strSql, myConnection)
daVarTables = New OleDbDataAdapter()
daVarTables.SelectCommand = New OleDbCommand(strSql,
myConnection)
NewRow = dsVarTables.Tables(dcSheetName.ColumnName).NewRow()
oleCB = New OleDbCommandBuilder(daVarTables)
oleDBC = oleCB.GetInsertCommand
strSql = oleDBC.CommandText "Used this to make sure I had a
valid INSERT statement
The code Fills each Value in new Data Row....
.
.
.
dsVarTables.Tables(dcSheetName.ColumnName).Rows.Add(NewRow)
dsChanges = dsVarTables.GetChanges(DataRowState.Added)
dbgChanges.DataSource = dsChanges.Tables(1)
dbgChanges.Refresh()
If NewRow.HasErrors() = True Then MsgBox("New Row Has Errors")
Try
RecUpdated = daVarTables.Update(dsChanges)
Catch err As Exception
MessageBox.Show(err.Message)
End Try
MsgBox((dcSheetName.ColumnName) + Str(RecUpdated) + " records
Updated", MsgBoxStyle.OKOnly) Tag: Xml Schema Relations Tag: 89856
DataView Question
Ok, I have a dataview that may or may not have a rowfilter. If I do have a
rowfilter applied, how can I quickly find out what the total number of rows
are from the unfiltered state.
A user can take actions against records during either state, but I need to
accurately display both the total records in the view (unfiltered) and
(filtered) at ALL TIMES.
Please help.. Tag: Xml Schema Relations Tag: 89850
cleared textbox reverts to orginal value
When I have a text box that is bound to a number field in my dataset (not even a strongly-typed dataset), clearing out that field by selecting the text and pressing delete raises a first-chance exception in mscorlib of Input string was not in a correct format then ignores the update to the field and reverts back to the original text. Is there any way around this? My users have to type in 0 into any field they want to clear, but 0 and "" or null do not necessarily mean the same thing. Tag: Xml Schema Relations Tag: 89846
Progress bar doesn't increment
I created a windows form that has a progress bar on it. I am running a bunch of statements to update data on the database. I want the progress bar to increment (perform one step) after each update. The problem is that the progress bar doesn't move (it just sits there until the end) can anyone give me an example of how to accomplish this?
example:
progressBar1.Visible=true;
progressBar1.Show();
progressBar1.Maximum = 24;
progressBar1.Step = 1;
progressBar1.PerformStep();
Perform_update1;
progressBar1.PerformStep();
Perform_update2;
progressBar1.PerformStep();
Perform_update3;
etc.
thanks in advance
-Jeff- Tag: Xml Schema Relations Tag: 89843
Update and TimeStamp Question
Hi,
I am using a timestamp column to manage my concurrency on updating. My
question is on the update should I create a new timestamp colmn on the
server side or the client side? And how would I accomplish that?
Thanks Tag: Xml Schema Relations Tag: 89839
ExecuteScalar function question
Does the ExecuteScalar function use a DataReader behind the scenes? I
had 2 objects that used the same IDbConnection object, and each
object called ExecuteScalar(neither called ExecuteReader). One
completed successfully, the other got the error that a DataReader was
already opened and must be closed first. So I guess ExecuteScalar
uses a Reader?
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com Tag: Xml Schema Relations Tag: 89832
SQL db or Flat File storage option
Let's say I have a stand alone app that was conceived/created decades
ago and has been updated through the years. It's a basic CRUD
application with the data stored in a positional flat file. After
data is entered, calculations are performed and are displayed to the
user. If all is well, the user submits the data for batch processing
and awaits results. During this batch processing, the data takes many
forms before again being sent away for even more processing. I'll
call this the legacy app.
Over the last few years, this legacy app has been accompanied by a web
based product providing most of the same features. Naturally, the
developers fired up their SQL Server and built an ASP based web site
with about 60 data collection forms. After data entry, the data in
SQL is transformed into the same positional flat file as in the legacy
app. Then processing is the same. The site's performance has
deteriorated under heavy load in recent years.
It's been suggested, as a way to improve performance, that we
eliminate the SQL storage and perform the CRUD operations directly on
the positional flat file by way of CGI. I guess the idea is to cut
out the middle man. My suspicion is that this was suggested on a whim
and someone ran with it.
This sounds like a large amount of file I/O and I would prefer to use
ado.net and SQL server but am meeting resistance. I don't mean to
start a flat file ?vs- db flame war and if I'm in the wrong group
please let me know.
My question is this?
With about 15k users/day and about 400 pieces of data each, would
anyone really use a flat file as their data storage option, why or why
not?
-Cliff Tag: Xml Schema Relations Tag: 89828
Connection Box
What is an equivalent to an Ole Connection box (or ODBC Connection box) for ADO.NET providers?
Thanks in advance.... Tag: Xml Schema Relations Tag: 89820
Could not find installable ISAM
I'm attempting to read from an Excel file with a oledb.oledbconnection and
get an error "Could not find installable ISAM".
How does one fix this problem and does this fix need be done in both design
time and deployment to the client (as with .net framework)?
Thanks. Tag: Xml Schema Relations Tag: 89819
ADO.NET, Text Driver, Unicode
I'm having a problem using ADO.NET/C# to read unicode from a CSV text
file. There is a row with a single column containing two unicode
characters. I read it, get the bytes and try encoding them but it's
not giving me a result I can use for string comparisons. I've tried
using the Unicode encoding the UTF7 encoding and the UTF8 encoding to
no avail.
Here's a boiled-down code snippet. Please tell me the error of my
ways...
// Note the funky Unicode quotes.
// Everything from the browser to notepad
// to the VS.NET editor handles them.
String sCompare = "ABC "X" DEF";
String sTemp = "";
byte [] buf = null;
// Get buffer length.
long lLen = adoReader.GetBytes(
adoReader.GetOrdinal("MyColumnName"),
0, null, 0, 0);
// Allocate buffer.
buf = new byte[lDescLen];
// Get bytes from ADO.
lLen = adoReader.GetBytes(
adoReader.GetOrdinal("MyColumnName"),
0, buf, 0, (int)lLen);
// I've tried the other likely encodings. Unicode and UTF7.
System.Text.UTF8Encoding e8 = new System.Text.UTF8Encoding();
sTemp = e8.GetString(buf);
// This never compares equal...and it should compare equal.
if (sCompare.Equals(sTemp))
{
do_something();
}
else
{
do_something_else();
}
Thanks. Tag: Xml Schema Relations Tag: 89811
Linked tables
Hi,
Can anyone tell me how to create a linked table in an
Access database, using ADO.NET?
Thanks
Iain Tag: Xml Schema Relations Tag: 89807
SQLCE Problem on Create Table
Hey ppl,
I am having trouble in building a smart device application. I cant create a
table on SQLCE server using this line. Anyone can tell me what the problem
is?
I am able to create another 3 Tables same way but this SQL line is always
gives me problems.
command4.CommandText = "CREATE TABLE MUSTERI (INDEXMS nvarchar(5),MSAD
nvarchar(30),MSSOYAD nvarchar(30),MSSEMT nvarchar(30),MSSEMTRCH
nvarchar(30),MSTLF nvarchar(15),FIYAT nvarchar(3),INDEXBY
nvarchar(4),VHMARKA nvarchar(30),VHMODEL nvarchar(50),VHLSEBAT
nvarchar(20),VHYIL nvarchar(4),LASONMRK nvarchar(20),LASONDSN
nvarchar(30),LASRKMRK nvarchar(20),LASRKDSN nvarchar(30),VHDSSGON
nvarchar(10),VHDSSGRK nvarchar(10),VHDSSLON nvarchar(10),VHDISSLRK
nvarchar(10),VHPLAKA nvarchar(15),VHIDHVON nvarchar(3),VHIDHVRK
nvarchar(3),TARIH nvarchar(10),USER nvarchar(5))" Tag: Xml Schema Relations Tag: 89797
DataView.Find() after sorting datagrid
I'm getting an "invalid cast" error message when trying do use Dataview.Find() method to get the row I need to update in my datagrid. The problem just occurs after I sort the datagrid by a non default order.
// Update grid code
string key = DataGrid1.DataKeys[e.Item.ItemIndex].ToString();
int rowIndex = dv.Find(key);
//Sort Grid code
dv.Sort = e.SortExpression;
DataGrid1.DataBind(); Tag: Xml Schema Relations Tag: 89795
Validating XML File and ReadXML
I've been writing an application that reads an XML file into a dataset using ReadXML. The XML file has its own schema (declared with xsi:noNamespaceSchemaLocation).
I've been testing the error handling of the application by changing the underlying XML.
When I use ReadXML using the filename as a parameter, it doesn't seem to validate the XML property. One specific case is when I have an enumeration for one of my tags. If I enter an invalid enumeration, no exception is raised by ReadXML.
I've solved my problem by creating an XMLValidatingReader object and then using that as the input to the ReadXML call. This does raise an exception but does not seem to havehave anything particularily useful as a error (eg line number of fault, etc) instead returning "System Error".
Is this behaviour expected.
I've also noticed that if I use the "ReadSchema" mode it doesn't fill the dataset. It does it I use the "Auto" mode. I understood the "ReadSchema" mode to mean use
the schema and then load the data.
Any suggestions as to why it doesn't load or have I misunderstood something. Tag: Xml Schema Relations Tag: 89793
OleDbParameter - Maybe not a bug... but it still sucks!
Howdy,
Can someone please explain the rational of letting an OleDbCommand take more
parameters than the query string is expecting. If i have 3, ???, in an
Access Query string, and i supply 4 parameters, it DOESN'T fall over/throw
an exception? Whats the benefit to the developer of this behaviour?
Ive just wasted 45 bloody minutes dicking around with this? O.k so i should
have looked a little closer... and it's probably my own damn fault for using
dirty old A2K as a datastore, but the query actually had 21 paramters and i
only supplied 20 ?.
I'd much rather it fail, than pass through the values all out of order....
because it still allows an invalid method to return true. This behaviour is
a bunch of arse.
:(
What an incredibly dull reason for the error. I was expecting something a
little more FANTASTIC!
TIA
Richard Tag: Xml Schema Relations Tag: 89791
Synchronising problem Datagrid and textbox
New to .NET question-
I have a datagrid, and a few textboxes bound to the same datasource.
When changing a row on the datagrid the textboxes are in sync (as expected).
If I filter the datagrid like this:
ds.Tables("t").DefaultView.RowFilter = aFilter
the datagrid view is not updated unless I do this:
dg1.DataSource = ds.Tables("t").DefaultView
The problem is then the textboxes are not synced with the datagrid any more.
What should I do?? Change the way I filter? Do something with the textboxes?
Thanks
Andrew Tag: Xml Schema Relations Tag: 89790
Using MSDE with Access 2000
I'm working on a project where I'm gradually phasing out an Access
2000 application with one written in VB.NET 2003 using the same
database as a back end. The company wants to phase out Access
altogether in favor of SQL Server within about a year. I can't just
drop Access altogether because the users still have to enter most of
their data through it's front end, but neither do I want to code
everything in my .NET application using OLEDBConnection since they'll
be a lot of work to convert it all over to SQLConnection in a years'
time.
It occurs to me that the best solution would be to use SqlConnection
but connect to the Access database. Can this be done in any way? Is
there a better solution that I'm missing?
Lee Tag: Xml Schema Relations Tag: 89787
plz help(reg Insert checkbox in datagrid columns dynamically)
hi ..
i am displaying 20 records using dataset in a datagrid.after displaying 20
company names from a table a user need to select multiple companies and
send a email to particular manager. i want to insert checkbox dynamically
with each company name so that user can select and send email.
i tried many ways but <asp:datagrid is not accepting to insert checkbox..
can one plz provide some help plz
Sub Page_Load
Dim conn1 as SQLConnection
If not IsPostBack then
dgleads.DataSource =GetLeads()
dgleads.DataBind()
...................
...................
.................
<FORM id="Form1" runat="server">
<asp:datagrid id="dgleads" Runat="Server" AutoGenerateColumns="False"
PagerStyle-Mode="NumericPages">
<asp:HyperLinkColumn DataNavigateUrlField="Leadid"
DataTextField="OrganisationName" HeaderText="Org Name">
</asp:HyperLinkColumn>
thank u Tag: Xml Schema Relations Tag: 89785
Inserting Deleting Rows in DataView
Hi,
I have a DataView attached to a DataTable Class. I need to insert and delete certain rows in arbitrary position using the DataView. Somewhat like InsertAt (index) RemoveAt(Index) functionality is what i am looking for. Can anybody guide me here.
Thanks
--------------------------------
From: Renuka Prasad
-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)
<Id>soyImPniiESnpdJvqHzMqw==</Id> Tag: Xml Schema Relations Tag: 89783
ADO, SQL, C#, ListBox : DataSource, DisplayMember & DataBinding
Good Day all,
I'm working on VisualStudio.net and on SQL Server 8.0
I'm using a WindowsForm with a ListBox, some TextBox, some buttons, a DataSet, an sqlDataAdapter and an SqlCommand.
I fill my DataSet normally with this command at the startup of my application
(SqlConnection cnxSqlConnexion;)
(SqlDataAdaper sdaSalles;)
(Dataset dsSalles;)
cnxSqlConnexion.Open();
sdaSalles.Fill(dsSalles, "SALLES");
cnxSqlConnexion.Close();
I've been set my ListBox DataSource and DisplayMember property with the folowing values :
(ListBox lstSalles;)
lstSalles.DataSource <- dsSalles
lstSalles.DisplayMember <- SALLES.NOMSALLES
When I add a new record all work well :
...
this.BindingContext[dsSalles, "SALLES"].AddNew();
...
...
...
this.BindingContext[dsSalles, "SALLES"].EndCurrentEdit();
...
When I delete a record, I have a problem with the ListBox
...
this.BindingContext[this.dsSalles,"SALLES"].RemoveAt(this.BindingContext[this.dsSalles,"SALLES"].Position);
...
All records in the listBox are deleted excepted the last one who is deleted from the DataBinding but Stay in the lstSalle.List.
Please how to make it leave the lstSalle.List ?
thank's for any solutions ! Tag: Xml Schema Relations Tag: 89778
HOWTO: Reload DataSet?
Hello,
I'm working on basic VB.NET winforms Client-Server application with
SQLServer as backend.
When users open a particular form, the data is loaded into DataSet and
controls are bounded to it. When one user changes the data and saves
it, the changes are saved to the database and also reflected on his
dataset. However, the changes are not seen by other users, who have
the same form open, until they reload their datasets.
Is this a normal .NET behavior?
Is there a way to automatically propagate the changes?
If not, how can I efficiently reload the DataSet? (Our datasets are
quite big, around 20,000 records)
When reloading a DataSet, do I have to rebind the controls too?
Thanks in advance.
Regards,
Dmitri Tag: Xml Schema Relations Tag: 89776
Converting codepage values from SQLServer
I have a simple table in sqlserver which stores variable
codepage-encoded string values, and the corresponding codepage code
value.
Example: TableCP
CPString (varchar) CPCode (int)
------------- ----------
?????® ?Æ?«?å 111 932
ÐÂ¼ÓÆÂ¹«Ë¾111 936
I'm trying to extract out the contents and write them out in UTF8 to a
text file.
[code:1:e2a7854e72]
//...
FileStream fs = new FileStream("C:\\text.txt",
FileMode.OpenOrCreate);
foreach (DataRow dr in dt.Rows)
{
StreamWriter t = new StreamWriter (fs, Encoding.UTF8);
string val =
Encode(Convert.ToString(dr["CPString"]),
Convert.ToInt16(dr["CPCode"]));
t.WriteLine(val);
t.Flush();
}
//...
public static string Encode(string srcValue, int srcEncCode)
{
Encoding srcEnc = Encoding.GetEncoding(srcEncCode);
Encoding targetEnc = Encoding.UTF8;
byte[] srcBytes = srcEnc.GetBytes(srcValue);
byte[] encBytes = Encoding.Convert(srcEnc, targetEnc,
srcBytes);
return targetEnc.GetString(encBytes);
}
[/code:1:e2a7854e72]
I am not having any luck with the encoding conversion. It simply spits
out garbage. I'm well and truly stumped. :? Can anyone help?
Big thanks in advance.
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com Tag: Xml Schema Relations Tag: 89775
Strange concurrency lesson on Update
Built a stored procedure to do an update on a table with 16 fields. When I
tried to update the database with the table data, I got a concurrency error.
Went through the code, the stored procedure, the command parameters, the
whole deal -- everything looked perfect. So I had the DACW build me the same
stored procedure. Reviewed it line-by-line, comparing. It looked
identical -- except for my decimal values, where I had entered the precision
but not the scale. Could not believe that was causing the error, but lo and
behold -- yes, Virginia, failing to specify the scale of your decimal fields
in the stored procedure will cause a concurrency error. Hope that saves
someone else a few hours. Tag: Xml Schema Relations Tag: 89771
create a Dataset Column in int32 or timespan?
I trying to create two columns in a dataset with the type of int32 and
Timespan but i get a message that this is not a valid datatype. In the
example code under the help text on DataType you find following text (cut
out of the helptext)
Dim colInt32 As DataColumn = New DataColumn("Int32Col")
colInt32.DataType = System.Type.GetType("System.Int32")
myTable.Columns.Add(colInt32)
Dim colTimeSpan As DataColumn = New DataColumn("TimeSpanCol")
colTimeSpan.DataType = System.Type.GetType("System.TimeSpan")
myTable.Columns.Add(colTimeSpan)
That take I as it should be possible to do it If not what type can i use for
Time and Integer?
other datatypes works fine within the same code.
Petter L. Tag: Xml Schema Relations Tag: 89770
AddNew method
I am fairly new to ADO.NET, is there an ADO.NET method that
is similar to the AddNew method that existed in ADO for adding new
records to a database.
Martin Tag: Xml Schema Relations Tag: 89765
string vs datetime columns
Hi
i have an untyped Dataset with a string column that contains datetime.
is there a way to add another column which points to the string column and
reflects the info as datetime.
I dont want to copy the information, only reflect the info.
Thank,
Uzi Tag: Xml Schema Relations Tag: 89760
Checking for a null value in a dataset
I have a one record dataset with a number of fields. Some of the fields
have null values. When I try to use these field VB.Net thoughs an error
about them being null.
If DataRow.IsNull(objDS.Tables(0).Rows(0).Item(0)) Then
Gives me the error:
Reference to non-shared member 'Public Function IsNull ( ByVal columnName As
String ) As Boolean' requires an object reference.
Any ideas?
Thanks Tag: Xml Schema Relations Tag: 89755
Getting id's of composite controls
I can't seem to get the id of the child controls of my composite control. I
can get the unique id but the id when I try to access it via the controls
collection comes back null. Do I need to add a form tag within the control
rather than on aspx parent page. Any ideas? Regards, Chris. Tag: Xml Schema Relations Tag: 89748
When I bring an existing schema into the XML designer, right-clicking the relation object (grey square) doesn't allow me to select Edit Relation.
Same with XML Schema toolbar.