Datagridview image column nulls
I've got a datagridview bound to Sql2k database. When the image columns
return null, I get the goofy looking [X] in the column instead of a blank.
Anyone know how to make that just appear as empty instead of the default
[X]? I would also like that to appear as empty when I insert a new row
instead of the [X] if that is possible. Tag: Important Information Tag: 134789
Insert in Access threw typed dataset Tableadapter
After creating the typed dataset , i've created the wanted sql functions in
the .xsd file. Now i'm trying to enter the data into database threw the
insert query that was automaticly created by .net .
Must add that in the access itself the sql query work , so i'm pretty sure
that the syntax is correct.
Also the fill of the datatables does work , so the connection to the
database is also right.
Insert into 'tablename' ('col1','col2') values (?,?) - was created by .net
at the beggining. after testing the query at access it worked when i've
changed it to:
Insert into 'tablename' ('col1','col2') values (col1,col2) - and actually
entered the data into database.
The data wouldn't enter.
Are there any more adjustment i have to do? Tag: Important Information Tag: 134784
Beginning question for Access OLEDBUpdate command
I used the wizard in VB.NET 2003 to generate a data adapter and it created
the following update command. It seems like the WHERE clause would never
evaluate to true? Am I reading this wrong?
The member_ID is the key for the table but it looks like the 2 statements
checking the address_1 and address_2 values would only be true if no changes
were made.
Me.OleDbUpdateCommand1.CommandText = "UPDATE Member_Listing SET address_1 =
?, address_2 = ? WHERE (member_ID = ?) AND (address_1 = ? OR ? IS NULL AND
address_1 IS NULL) AND (address_2 = ? OR ? IS NULL AND address_2 IS NULL)
Thanks for your help.
Dave Tag: Important Information Tag: 134769
Migrating from MS ACCESS 97 to SSEv
I am writing an application to migrate an Access 97 database file to SQL
Server Everywhere database file in VB.NET
I have code that builds the required tables in a new SSEv database file,
"CREATE TABLE", but am stumped at not being able to detect if the Access
field is AUTOINCREMENT.
I use standard methods to connect to the Access database, ADODB
The code field.Properties("ISAUTOINCREMENT").Value always returns false
even when the property value is AutoNumber in Access.
Also field.Properties("KEYCOLUMN").Value always returns False even when a
field is the primary key.
Does anyone have any solutions.
ADOX did not help either giving similar results
Garry Tag: Important Information Tag: 134764
please help! Error in update Access database
I have been trying to update in Access Database. I get this error "Syntax
error in UPDATE statement." What could be the problem or can somebody
suggest different solution.
I call this function from my main page.
Public Shared Function UpdateScholarship(ByVal ID As String, ByVal Name As
String, ByVal Amount As String, ByVal Year As String, ByVal Criteria As
String, ByVal Conditions As String)
Dim connection As New OleDbConnection(ConnectionToDatabase)
Dim UpdateString As String = "Update ScholarshipDescription Set
[Name]='" & Name & "', Amount='" & Amount & "', Year='" & Year & "',
Criteria='" & Criteria & "', conditions='" & Conditions & "' Where ID='" &
ID & "'"
Dim command As New OleDbCommand(UpdateString, connection)
connection.Open()
command.ExecuteNonQuery()
connection.Close() Tag: Important Information Tag: 134758
MS Access DAO -> ADO.NET Migration
I have an VB6 program that I wrote that access Microsoft Access
databases using DAO. DAO has methods and properties that are Access
specific (such as viewing and editing relationships or indexes on the
tables) I want to write a new version of the program in VB 2005, and I
want to use ADO.NET to access the data. Are there ways of changing the
indexes or relationships of the MS Access database using ADO.NET? Or do
I still need to use DAO to perform these operations?
As a side note, with a few tests that I've done already with some
queries, it seems like DAO is much faster than ADO.NET at running
queries and returning results. I am using the DataReader...does anyone
have any information about the differences etc? Thanks in advance... Tag: Important Information Tag: 134757
webservice - dsn - sql server
I've created ODBC DSN for sql server.
When i connect from win application works OK.
When i make WebService (on same machine) that connects to that ODBC
connection fails:
Error:
Server was unable to process request. --> ERROR [28000] [Microsoft][ODBC SQL
Server Driver][SQL Server]Login failed for user '(null)'. Reason: Not
associated with a trusted SQL Server connection.
ERROR [28000] [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed
for user '(null)'. Reason: Not associated with a trusted SQL Server
connection.
ODBC is configured to use SQL Server authentication (login id and passwd) Tag: Important Information Tag: 134744
Can anyone explain this: Numeric or Value Error Line 1
I have a stored procedure that starts out like so:
PROCEDURE test_proc(param1 IN VARCHAR2, param2 IN VARCHAR2, param3 OUT
SYS_REFCURSOR) IS
v_var varchar2(5);
BEGIN
SELECT * FROM. . .
The procedure tested fine in PL/SQL Developer. When calling from
ODP.NET like so. . .
OracleCommand cmd = new OracleCommand("test_proc", <connection>);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("param1", "somevalue");
cmd.Parameters.Add("param2", "XX");
cmd.Parameters.Add("param3", OracleDbType.RefCursor,
ParameterDirection.Output);
DataSet ds = new DataSet();
OracleDataAdapter da = new OracleDataAdapter(cmd);
con.Open();
da.fill(ds);
con.Close();
. . .the procedure executed as expected. If I changed the value of
param2 to "XXX" or any value three chars long I got the "ORA-06502:
Numeric or Value Error at Line 1" error.
After beating my head against the wall for hours, I tried changing the
size of v_var to 50, and the error disappeared. Mind you, the error
was being thrown long before v_var was being set further down in the
proc. Even more interesting is that the possible values of v_var were
all *less than 5 chars wide.*
Can anyone explain this? Tag: Important Information Tag: 134730
Problem following first example in "Programming MS ADO.NET 2.0" by David Sceppa
I did the example twice with two different databases (Adventure works
using MS SQL Server 2005, and an MS Access database).
Although the data sources I used were different than Mr. Sceppa's, the
SQL Server DB (AdventureWorks) wored flawlessly while the trial using
the MS Access database did not. The apparent problem when I tried
using an MS Access database is that the database appears to be empty,
with only a schema (and in fact I know there is at least 80 MB of data
in it).
There are no compile time errors.
At compile time, and design time, I can see almost all of the database
objects in the MS Access database. The only things that seem to be
missing are the relationships among the tables. The tables and views
are all there!
At run time, there are no errors when using the Adventureworks data,
and I can browse through the data one person at a time. When I try to
run the project that uses the MS Access database, I get the following
errors:
A first chance exception of type 'System.InvalidOperationException'
occurred in System.Data.dll
A first chance exception of type 'System.InvalidOperationException'
occurred in System.Data.dll
The thread 0x570 has exited with code 0 (0x0).
The thread 0xe4c has exited with code 0 (0x0).
There is output prior to these messages, but that output contains no
reference to any problem implying the first mention of an exception
shown above is the first occurance of an error.
I do not have MS Access installed, but as I am running Windows XP Pro
(the 64 bit version), jet seems to be present. I am working within the
professional edition of MS Visual Studio 2005, and I have installed MS
SQL Server 2005.
WHY would I have problems getting a C# windows application using
ADO.NET 2 to use an MS Access database while using the same method to
develop the program to use an SQL Server database works just fine?
I find this very odd since I have another application (2 years old),
written in C++ and using ADO/MDAC to work with the very same MS Access
database, and this other application works fine (and this on the same
machine I'm trying to use to develop these programs)!
If it is the case that Jet is basically severely broken, is there an
easy way to move an Access database into SQL Server?
Ted Tag: Important Information Tag: 134727
DataAdapter for Insert
Hi, I'm using a DataAdapter with sqlserver(Express) in a server app.
The SQL Insert is generated with an additional Select when not checked off. How can the result of this generated select be accessed? GetData() with get all the data in the table and not the just inserted data.
Thanks
BoM Tag: Important Information Tag: 134726
2.0: well-written sample application?
Hello,
I am learning .NET 2.0 (C#, VB, ADO.NET, ASP.NET) and I am looking for a
well designed and coded database application - prefably using SQL Server
2005 and ASP.NET.
Could you give me a link to such appliacation or send me source?
Thank you VERY MUCH!
/RAM/ Tag: Important Information Tag: 134724
TransactionScope exception handling
Is there any way to have an DataReader.Read part of a TransactionScope but not cancel the transaction if the read fails?
I'm using a DataReader to get the result of a stored procedure which increments a counter. I'd like to add the read to
the transaction only if the read is successful. If the read isn't successful I don't want it to cancel the entire
distributed transaction but I will need to roll it back (since the SP updates a table) if some other part of the transaction fails. Tag: Important Information Tag: 134722
DataSet has no rows when proc is returning rows??
Hello,
Im going insane with this problem. I have a stored proc that returns 2
recordsets to a dataset. In the dataset i reference the recordsets by
their tables like below.
ds.tables[0]
ds.tables[1]
In the first table it says their are 0 rows. The columns get populated
but no rows. I run the proc outside VS and the results are correct. In
the datase i can reference the second table and pull the rows i need.
For what ever reason the first dataset is always empty. I have used
this methods before and works great but for some reason it doesnt like
the first recordset.
In my proc I have 'set nocount on'
code below.
Here is a run down of the proc.....
Query 1:
SELECT a.first_name ,a.last_name, upa.organization_id, b.index_code as
EmployeeID
FROM person_name a, person_indices b, v_user_profile_app upa
WHERE a.person_nbr = b.person_nbr
AND b.index_code = (SELECT c.code_nbr
FROM v_code_entries c
WHERE c.table_code = "INDXTP"
AND c.code = "EMPNUM")
Query 2:
Select RoleName FROM UserRoles WHERE person_nber=@person_nbr Tag: Important Information Tag: 134719
DaatSet has no rows when proc is returning rows??
Hello,
Im going insane with this problem. I have a stored proc that returns 2
recordsets to a dataset. In the dataset i reference the recordsets by
their tables like below.
ds.tables[0]
ds.tables[1]
In the first table it says their are 0 rows. The columns get populated
but no rows. I run the proc outside VS and the results are correct. In
the datase i can reference the second table and pull the rows i need.
For what ever reason the first dataset is always empty. I have used
this methods before and works great but for some reason it doesnt like
the first recordset.
In my proc I have 'set nocount on'
code below.
Here is a run down of the proc.....
Query 1:
SELECT a.first_name ,a.last_name, upa.organization_id, b.index_code as
EmployeeID
FROM person_name a, person_indices b, v_user_profile_app upa
WHERE a.person_nbr = b.person_nbr
AND b.index_code = (SELECT c.code_nbr
FROM v_code_entries c
WHERE c.table_code = "INDXTP"
AND c.code = "EMPNUM")
Query 2:
Select RoleName FROM UserRoles WHERE person_nber=@person_nbr Tag: Important Information Tag: 134718
Optimize DataTable Select Method
Hi all,
How can I optimize the DataTable Select Method to make it faster
Can I create a Text Index Search ?
Thanks alot
Regards Tag: Important Information Tag: 134715
Opening PDF document in new window on click of linkbutton column in datagrid
Hi,
I need to open PDF document in new window when i click on linkbutton
in datagrid.For that i have written code as below:
But the problem with this code is that it opens the new window ,but not
loading the pdf.Please let me know how can i solve this issue.
private void grdTest_ItemCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
if(e.CommandName=="View")
{
LinkButton btn =
e.Item.FindControl("linkView") as LinkButton;
GetPDF();
btn.Attributes.Add("Onclick","window.open('TestData.aspx');" +
"return false;");
}
}
Here is the GetPDF function:
public void GetPDF()
{
FileStream fs;
string fname;
fname = MapPath("../") + "via
project/documents/Mass_title.pdf";
fs = File.Open(fname, FileMode.Open);
byte[] data = new byte[fs.Length];
int i=(int)fs.Length;
fs.Read(data, 0, i);
fs.Close();
Response.Clear();
Response.Charset = "";
Response.ContentType = "application/pdf";
Response.AddHeader("Content-Disposition",
"inline;filename=pdfTest.pdf");
Response.BinaryWrite(data);
Response.End();
}
Thanks,
Vishnu Tag: Important Information Tag: 134714
BindingSource1.AddNew()
Help,
I have created Windows app with VS2005.
I then drop the datanavigator control and bindingsource control to the form.
I bind a dataset tablet to the binding source and set the navigator to the
bindingsource control , all wonderfull.
The Problem
I click to add a new record , it doesnt go to the end ? it goes to record 1
and seems to lose records 1 data.
I have tried adding my own button on there with the code
BindingSource1.AddNew()
, but this does the same. How do I got to the newly created record.
Thanks
Neil Tag: Important Information Tag: 134712
MS Data Application Block
Hi,
In .NET 1.0 and 1.1 I used the Microsoft Data Application Blocks for
executing Stored Procedures etc.
In .NET 2.0 is there a newer version of these blocks or has the way Data
Access works been changed?
Thanks,
C Tag: Important Information Tag: 134710
Why 1990 for ShortDate
I use a update command to update a smallDateTime filed:
Update [Checks] set Checks.CheckDate=''
It udpate the CheckDate field to 1990/01/01
Why? Tag: Important Information Tag: 134707
Concurrency violation
I'm just starting to try and learn ADO.NET and was following along in
Murach's VB.NET/ADO.NET book samples for typed databases with unbound
controls.
When I try to execute an update with the my data adapter and the data table
as a parameter, daMembers.Update(dsMembers.Member_Listing), I get a
concurrency violation. I'm not sure how to track down the problem.
Basically I'm doing the following; open the connection, set data adapters
selectcommand text, fill the dataset, get a data row from the table, put the
data into controls on a form, change the data, put the changes into the data
row, and execute the update command.
' load dataset
cnRosterDB.Open()
daMemberList.SelectCommand.CommandText = sSelectCommand
daMemberList.Fill(dsMembers)
cnRosterDB.Close()
' get a record
drMemberRow = dsMembers.Member_Listing(0)
With drMemberRow
txtID.Text = .member_ID
If .Islast_nameNull Then
txtLName.Text = ""
Else
txtLName.Text = .last_name
End If
If .Isfirst_nameNull Then
txtFName.Text = ""
Else
txtFName.Text = .first_name
End If
end with
' put edited data into data row
With drMemberRow
.member_ID = CInt(txtID.Text)
.last_name = txtLName.Text
.first_name = txtFName.Text
end with
' try to update the database
daMemberList.Update(DsMembers.Member_Listing)
Any guidance would be appreciated,
Thanks
Dave Tag: Important Information Tag: 134697
update values to excel data source using ADO.NET
I've been able to connect to my excel spreadsheet using ADO.NET and
display the data in a Datagrid. Now I need to know how to take the
values in the datagrid and repopulate the excel spreadsheet. The end
users will be editing the data in the datagrid and I have another
application that will be consuming the excel file. Again any help on
how to repopulate the entire datagrid to the existing excel spreadsheet
will be greatly appreciated.
Thanks
Christian Tag: Important Information Tag: 134696
convert DataColumn.GetType() into a DbType or SqlDbType?
I have a DataColumn, want to derive the DbType. I can do column.GetType()
but that's a system type, not a db type. How do I convert it to the
corresponding type?
Thanks much!
Chris B. Tag: Important Information Tag: 134695
Typed DataTable Question
Someone told me that I could create a Typed DataTable WITHOUT first
creating a Typed DataSet. I may be new to .NET programming, but I know
that, based on what I've learned, this isn't correct.
Am I right or not?
Thanks! Tag: Important Information Tag: 134694
More advanced examples for the impatient "newby"
Well, I've taken poetic license with "newby" having been programming
for more than a couple dozen years, but I have recently started
studying .NET and ADO.NET, leveraging my experience with other
frameworks such as Borland's VCL, and MS' MFC, and technologies such as
ADO and MDAC, to speed things up.
I have the professional edition of Visual Studio 2005, with MS SQL
Server 2005, and I downloaded and installed ADO.NET 3, the relevant SDK
and extensions to Visual Studio for it.
I intend to experiment with ADO.NET with both a windows forms
application and a web application using ASP.NET.
With my readings so far, I see only simple examples where the master
control (either a text box or a combo box) determines what is seen in a
details grid.
The example I want to use in my experiments is a recipe management
database. The user's user ID will be a parameter in all queries. But
there will be several combo boxes for "Cuisine type" (e.g. Thai,
Mandarin, French, &c.), author (e.g. the user's name, some other
author's name), kind of dish (breakfast, lunch, entrez, appetiser,
desert), possibly with subtypes (e.g. for deserts, cake, pie pudding,
&c.). Some of these combo boxes will have a default value and require
selection of either the default or one other item in the combo box.
Others will allow a NULL value, and if the user decides there should be
a value other than NULL, he or she is constrained to select from the
items in the combo box. The author, for example, might be NULL, to
indicate the recipe may be an old family recipe or a recipe for which
the author is unknown. I guess this is simpler than some cases in that
the user will not be able to type entries into the fields, except for
the author, for which I'll need a validator. OTOH, it is more complex
in that the entries in the combo boxes do NOT affect in any way the
possible choices in any of the other combo boxes. The question I'm
wrestling with is how to use such a collection of controls to manage
what is shown in (in my case) a pair of details grids (one for
ingredients and another for instructions for a given recipe).
Can anyone provide an example, or an URL to a page that gives an
example, that shows how to do this?
The second example I am looking for is how to use a combo box tied to
one table as an editor for the cells in one column of the gridview tied
to another. For example, for the grid representing the ingredients
used in a recipe, the second last column will be a number representing
a quantity and the last column will be units of measure such as grams,
kilograms, ounces, pounds, teaspoons, table spoons, &c. Of course, the
number of possible units is limited, and should be selected from a
combo box rather than entered by the user typing (with all the related
potential sources of error such as typos). But to make things more
interesting, I want to give the user the option of selecting what
system of units (cgs, SI, Imperial) will be used both for entering and
for viewing a recipe, by default but with the option of changing the
system of units used for a given recipe (so a user prefering to use
metric can enter a recipe provided in imperial units and have my
program automatically convert it to metric). After all, a person most
familiar with metric might have, for whatever reason, a cookbook in
which all recipes are provided with imperial units.
Like I said, it is trivially easy for me to get applications similar to
the examples I have found (both in the provided MS documentation and
the multitude of books I have bought) to work, but their extension to
situations like what I describe above is not obvious.
I had thought about doing most of this in code, but I want to know if
there is an easy way to accomplish this using Visual Studio 2005's form
designer before I start writing n-factorial parameterized SQL
statements or a function to create them at run time.
Pointers(URLS) to more useful examples of using ADO.NET2/3 would be
greatly appreciated.
Thanks
Ted Tag: Important Information Tag: 134691
changing the text of linkbutton column in Datagrid
Hi,
I have the problem with the datagrid display. I want to change the
display text of linkbutton.Please
help me how can i do that.
<asp:TemplateColumn HeaderText="Minute Order" >
<ItemTemplate>
<asp:LinkButton ID="linkView" runat="server"
CausesValidation="false"
CommandName="View" Text='<%#
DataBinder.Eval(Container, "DMS
Id") %>' ></asp:LinkButton>
</ItemTemplate>
</asp:TemplateColumn>
When i use the above code,it displays the DMS ID which i should
not,instead i should display View .How can i do that? Please suggest me
the solution.
It has to display as shown below:
Minute Order
View
View
View
View
View
Thanks,
Vishnu Tag: Important Information Tag: 134689
MCSE,CCNA,CCNA Certificaiton Without Exams( PAY AFTER CHECK RESULTS)100% Passing Gaurantee
All Certifications Like
MICROSOFT,CISCO,COMPTIA,SOLARIS,ORACLE,SAP,MICOSOFT BUSINESS
SOLUTIONS,EMC at your doorstep without exams..and with 100% passing
guarantee...No need to go to any testing centre...we will do everything
on behalf of you...
We own several test centres worldwide and are able to offer you this
fantastic service.
If you would like a 100% guaranteed pass, then please read on
further......
Mail only at this email id :- all_certs@yahoo.com
Or log in to www.it-exam-shop.com
We are able to offer a guaranteed pass for the following: Microsoft,
Cisco, Comptia, Oracle, Solaris.
Please send a request for any test that you require and these will be
sat on your behalf at one of our officially approved testing centres.
All of the following prices include exam fees and a small
administration charge for the service.
For Prices :-
Login to www.it-exam-shop.com
This is our official website u can check our this website to more
info.....
As mentioned previously this is the TOTAL amount including exam fees
with no hidden extras.
NO payment will be required before getting exam results, so please do
not worry. This is a genuine offer.
We will sit the exams for you and then send login details for the
official secure testing site.
After confirmation of pass results you will be required to make payment
via the Western Union website.----( this facility is only available for
MICROSOFT exams only)
This offer is open to anyone worldwide. Our friends from the USA and
UK are always welcome!!
If you are interested in this incredible offer we will need the
following details in advance.
1. Candidates full name
2. Full postal address including country.
3. A scanned image of either a current valid passport or driving
license.
4. Landline or cell phone number
5. Correct exam numbers and names of exams required.
The current turnaround for exams is around 1 week. Usually a little
quicker.
If any further questions need to be answered then please feel free to
contact me on this
Email id...
All_certs@yahoo.com
Or login to www.it-exam-shop.com Tag: Important Information Tag: 134686
ado.net connection class?
Hello,
I'm fairly new to ADO.net and completely new to object oriented programming.
Could anyone point me to a good resource for creating specifically a
connection class using VB.net and ADO.net? If anyone could provide a code
snippet example, or point to where I might find a good one that would be
great.
Thanks!
Rick Tag: Important Information Tag: 134673
How can I get the value of an autoincremented column when adding new rows to a DataTable?
In the following situation:
System.Data.DataRow row = dataTable.NewRow();
row["someField"] = someValue;
// Set some more fields
dataTable.Rows.Add(row);
dataAdapter.Update(dataTable);
If the primary key of my table is an autoincrementing number, can I get to
it from here? Tag: Important Information Tag: 134672
How to Connect to SQL server 2005 ???
Dear all I try to retrive a set of data from an sql server 2005 database
with VS 2003
Following code is used :
m_sqlCon.Open()
m_sqlCmdObj = New Data.SqlClient.SqlCommand
m_sqlCmdObj.CommandType = Data.CommandType.Text
m_sqlCmdObj.Connection = m_sqlCon
m_sqlCmdObj.CommandText = m_SqlCmd
m_sqlCmdObj.CommandTimeout = 20
m_SqlAdapter.SelectCommand = m_sqlCmdObj
m_SqlAdapter.Fill(dsReelHist)
The .Open statement suceed
I get a SQL exception error " System error" when filling the dataset...
What is wrong here ?
Does framwork 1.1 is cabable of connection to SQL 2005 ?
regards
serge Tag: Important Information Tag: 134665
Slow access to data
Hi,
I'm building an windows forms app in C#, in wich I need to store &
retrieve data. It's a very simple use of data but the to retrieve a few
records, at the first time access, it takes about 4 to 5 secs (?!!). to
load 3 records with 6 coluns in each row.
Im using table adapters, and a .mdf file to store data. The SQL server
is the express ed. 2005.
Can someone help me to speed up the process?
Thanks in advance,
Jo=E3o Carias
(Quina) Tag: Important Information Tag: 134664
Best approach, Loading Tables
I need to create a sqlclient app to modify look up tables on a sql dbase,
there are some 8~10 tbls I think. I have some general idias of what to do,
but I have never done something like this, I am using VBExpress 2005. I
would be great if someone could give a roadmap of the steps to follow to load
the data to the client, concidering efficency and speed. I specially having
problem figuring out wich classes to use to load each table, maintaining the
constraints and all of that. If someone could give some idias I would really
appreciate it. TIA Tag: Important Information Tag: 134654
DataColumn Expressions
I have a typed DataSet with a DataTable where I added a column FullName that
simply returns the concatination of 2 other columns FirstName and LastName.
There is also a DataAdapter that returns this DataTable populated from the
DataBase.
If i Preview this data from the DataSet Designer, everything shows up fine
and that's the only case where the FullName expression shows up. If I call
the Adapter methods to populate the DataTable, the expression FullName column
is NULL.
Please help. All I want to do is have an extra column in a datatable with an
expression set in design time. This works if I add the column programatically
after the datatable is filled up. Tag: Important Information Tag: 134652
OleDbDataAdapter vs. SqlDataAdapter
I am wondering which DataAdapter to go with OleDbDataAdapter or
SqlDataAdapter? We are using this in a webservice using sql server 2005
and .net 1.1
Ruchir Tag: Important Information Tag: 134647
Urgent Please-Help me
Hi,
How do i call the below function on click of datagrid row.I want to
use hyperlink column.How do i call this function from hyperlink column
in a datagrid.
BLL method:
public MemoryStream GetMinuteOrderPdf(SearchParams sp)
{
DMS dms = new DMS();
sp.IsMinuteOrder = true;
return dms.getDocument(sp);
}
I am calling this function like this:
public void DisplayMinuteSearchResults()
{
Minute Min=new Minute();
Min.SearchMinuteOrders(sp,out ds);
//Also i need to add one extra column called MinuteOrder in ds that is
returned from BLL
DataColumn c1 = new DataColumn("Minute Order",
Type.GetType("System.string"));
ds.Tables["Events"].Columns.Add(c1);
HyperLinkColumn hcol=new HyperLinkColumn();
hcol.HeaderText="View";
hcol.DataTextField="Minute Order";
hcol.NavigateUrl=Min.GetMinuteOrderPdf(sp).ToString() ;
grdMinSearch.Columns.Add(hcol);
grdMinSearch.DataSource =ds.Tables["Events"];
grdMinSearch.DataBind ();
}
But when i implement this ,it is not displaying Datagrid.Please let me
know how can i solve this issue.
Thanks,
Vishnu Tag: Important Information Tag: 134645
Random database connectivity failure
Hello
We have a strange problem that someone maybe could help us with.
We have an ASP.NET application (NET 2.0) that uses Enterprise Library (2.0)
and nHibernate (1.2.0). Itâ??s compiled for any processor and runs in a native
x64 environment (2003 STE, IIS 6). It uses a SQL Server (05, x64, clustered
with active/passive).
The problem is that the SQL-Server in periods throws exceptions that
generate error messages, ADO.NET exceptions. If we use connection pooling we
get the following error:
â??Timeout expired. The timeout period elapsed prior to obtaining a
connection from the pool. This may have occurred because all pooled
connections were in use and max pool size was reachedâ??.
If we turn off connection pooling we are getting the following exception
â??An error has occurred while establishing a connection to the server. When
connecting to SQL Server 2005, this failure may be caused by the fact that
under the default settings SQL Server does not allow remote connections.
(provider: Named Pipes Provider, error: 40 - Could not open a connection to
SQL Server)â??
As we can see it, the second exception happens in the both scenarios
(pooling / no pooling), but when we use pooling the first thing that happens
is that the pool gets corrupted and after that the second exception is thrown.
During peak hours the exceptions is occurring within 5,10,15 and 20 minutes
intervals. We have turned off recycling of the worker process and uses inproc
session handling. During low use of the application the error also occurs but
of course not as frequent as under peak hours. We cant find anything
suspicious in the logs (IIS, EventViewer, SQL-Server). If we run performance
counters we donâ??t se anything indicating memory leaks / connection leaks. And
the thing thatâ??s really confusing is that it only happens in intervals and
that the database connections works most of the time, the error indicates
that the SQL-Server does not allow remote connections, but most of the time
it does?
Before we turned off recycling of the application pool we hade another
strange thing happening. We increased the virtual memory to 1024Mb and turned
of recycling, which caused the worker process of the application to recycle
itself every five minute.
The application is in production environment so we donâ??t have any big
possibilities to do testing to a large extent.
Regards
Tobias HÃ¥kansson
Varchar AB Tag: Important Information Tag: 134642
DataSource when using System.Data.OracleClient
Hi,
I am trying to connect a c# application to an Oracle 10i database.
I have not worked with Oracle before.
When using System.Data.OracleClient, willthe DataSource in the
connection string point to a DSN on the client machine, or does it need
to point to an Oracle Client configuration file?
Any help would be much appreciated.
Thanks... Tag: Important Information Tag: 134641
update DataSet - transaction
I have two tables in dataset, and appropriate TableAdapters.
How can i update both tables, but in transaction?
I other words:
THIS:
MyDSTableAdapters.Table1TableAdapter a1 = new ...
MyDSTableAdapters.Table1TableAdapter a2 = new ...
a1.Update(dt1);
a2.Update(dt2);
but where to put transaction ?
P.S. DataSet and TableAdapters are generated via VS 2005 form SQL 2000
ServerExplorer drag n' drop Tag: Important Information Tag: 134634
Another question about memory : System.IO.StringWriter and Dispose
Re hello,
I m' sorry for my questions ..
Under framework 1.1 with vb.net, i m using a StringWriter object to export
in .xls file.
To empty memory, I would like to use the propterty dispose on the object
StringWriter.
But i have received an error like this :
example :
Dim myStringWriter As System.IO.StringWriter = New System.IO.StringWriter
...
myStringWriter.Dispose(System.Boolean)(true)
myStringWriter=Nothing
>> Error
BC30390: 'System.IO.StringWriter.Protected Overrides Sub Dispose(disposing
As Boolean)' is not accessible in that context. it is protected..
I can use the Close() method but i m not sure that this last one have the
same effects for Garbage Collector ?
Is it possible to use Dispose method with StringWriter object
Thanks for you help
fabrice Tag: Important Information Tag: 134628
Strange problem reading Excel (xls) file with OleDB
Hi ,
I was looking for how to read an excel (xls) file when i thought to use
ado.net.
This is my code :
System.Data.OleDb.OleDbConnection dbConnection =new
System.Data.OleDb.OleDbConnection(
@"Provider=Microsoft.Jet.OLEDB.4.0;"
+ @"Data Source=myFile.xls;"
+ @"Extended Properties=""Excel 8.0;HDR=Yes;""");
dbConnection.Open();
And here's the strange thing : if I have myFile.xls open with Excel
while my code reach the .Open() method everythings is ok.
But if at that time myFile.xls is not opened (with excel) it throws a
"external table different from expected" exception.
What's happening? I don't want to use interop to read an xls file.....
Where am I wrong?
Nicola Tag: Important Information Tag: 134626
Handling multiple calls to sql2005 inside TransactionScope
Hi,
I'm developing an helper object to connecto to sql2005.
A problem arise when I'm trying to use transactions.
Say that I have this object structure
BusinessMethod
- DataAccessMethod1 -> sqlHelper
- DataAccessMethod2 -> sqlHelper
The BusinessMethod calls two data access methods that use my sqlHelper to
interact with sql.
Now I want to make every operation inside BusinesMethod transactional.
So I added in BusinessMethod a TransactionScope
-> using (TransactionScope tx = new TransactionScope()))
Everything works fine except the fact that opening and closing the
connection in sqlHelper cause an escalation from LTM to DTC.
The solution I tried is to create a new type that implements IDisposable
that receives in the constructor the TransactionScope reference.
The new type implements a factory that a sqlHelper can use to get the
connection. If a connection is already opened is returned to the sqlHelper
else is created and added to a connection pool.
This collection of connection is marked with the ThreadStaticAttribute (idea
from
http://blogs.msdn.com/dataaccess/archive/2006/02/14/532026.aspx)
In the Dispose method I dispose the connections opened from SqlHelper
(first) and TransactionScope (last).
This seems to work fine (there's some hidden problem with this approach?)
Why this isn't implemented in the TransactionScope Type?
Looking at
http://blogs.msdn.com/angelsb/archive/2004/07/07/175586.aspx
it seems that TranscationScope already keeps a collection of connection used
inside the transaction. Why they aren't closed in the TransactionScope
dispose method?
Thanks in advance for any help.
Carlo Folini Tag: Important Information Tag: 134624
Rows filtered out by a BindingSource
Using the .select method of DataTable I can filter out a row who match
certain criteria, and I make it the current one on the datagridview
which display that datatable.
However the datagridview does not bind directly to the datatable, but
to a BindingSource that binds to the datatable; I use that BS to filter
the data displayed, and when I do the selection described above I do
not want to obtain from the .select method all the rows already
filtered out, cause they should be discarded from my selection.
In short, how can I understand which rows have been filtered out by the
.filter method of the BindingSource and which instead are still
displayed? Tag: Important Information Tag: 134622
Bulk Copy Fail
I use SqlBulkCopy to write a DataTable into a table of a database, but it
fail with message:
Can not convert a string type of datasource into bit type of Destination
Table.
I want to know which filed cause the problem.
How can I do? Tag: Important Information Tag: 134617
How to deal with 'text' columns in ADO.NET
From what I can tell, when I "fill" a DataTable with a table that contains 'text' columns, I have no way of distinguishing these columns from regular nvarchar(x) columns. Does it truncate the values returned to 8000 characters? Or is the full text loaded?
My application is to generate a static T-SQL script that will populate that table. Because I can't seem to find a way to tell if an underlying column is 'text' or not, I can't figure out a way to generate the proper SQL script to fill the column and properly copy the row.
Can anyone help?
EggHeadCafe.com - .NET Developer Portal of Choice
http://www.eggheadcafe.com Tag: Important Information Tag: 134611
How many datatable/adapter should be put in a DataSet?
What's the best practise to put DataTables in DataSet designer? Should it be
partitioned by Business Logic Layer or one for each database table? or
something in between?
Thanks, Tag: Important Information Tag: 134610
DeriveParameters
I understand when I add a paramete like (name, value)
p = new SqlParameter("@someINT", 111);
that behind the sceens, a trip to the db is made to derive the parameter.
When creating a parameter what values must be specified to prevent the trip
to the server? For example below the size property is not specified. Does
that mean a trip will occur?
p = new SqlParameter("@RETURN_VALUE", SqlDbType.Int);
p.Direction = ParameterDirection.ReturnValue;
cmd.Parameters.Add(p);
thanks, Tag: Important Information Tag: 134605
Get SqlDbType
Is it possible to get a SqlDbType from a string?
like:
SqlDbType myType = Type.GetType("SqlDbType.int");
You can do this for framework types but couldn't figure out how to do it for
sql types.
thanks, Tag: Important Information Tag: 134597
Connect to Oracle
Is there a way to connect to an Oracle server in remote from a win app,
through OracleClient or OleDb without having to install the client
runtime on the user machine? Tag: Important Information Tag: 134592
Help - Dataset.Getchanges(DataRowState.Deleted)
Hi All,
I can get values from a dataset that have been changed by using the
following ;
Dim tempDataSet As DataSet = _
dataSet.GetChanges(DataRowState.Modified)
but I want deleted rows.
So I try
Dim tempDataSet As DataSet = _
dataSet.GetChanges(DataRowState.Deleted)
But I dont get any of the results,from reading I can see that the datarows
are only flagged for deletion and not removed from the dataset. I would have
thought using the GetChanges with DataRowState.Deleted would have returned
the rows.
What is the best way to get the deleted rows.?
Thanks
Neil Tag: Important Information Tag: 134590