Crystal reports paramaters
hi,
I'm using Crystal reports to generate a simple report in a VB.net windows
application, I've defined all my stuffs (accessMDB,query, 2 parameters) in
the report design, and it's working fine, when a report is opened it prompts
me to input the parameters values .
But, in order to incorporate this report to my application, I have 3
quetions:
1- How can I send the parameters from my form directly (so there will be no
prompt)?
2- How can I use a dataset (that I define by code in my form) as datasource
of the report (as parameter??) ?
2- And/Or how can I send the connection object (or connection string) as
parameter ?
note: I've an Access2000 database, and I use a strongly typed report -
reportDocument - crystalReportViewer to display the report.
Thanks a lot for your help. Tag: Coding Efficient Data References Tag: 68297
Saving dataset?
Dear friends
I have connected to an Access 2000 database and has retrieved a dataset from
the table "tblPersons". Adding a new row to the dataset is done as this:
Dim dr As DataRow
dr = ds.Tables(0).NewRow()
dr.Item("PersonID") = "some value"
dr.Item("Name") = "some value"
ds.Tables(0).Rows.Add(dr)
Me.BindingContext(ds, "tblPersons").Position = Me.BindingContext(ds,
"tblPersons").Count - 1
But how do I save the new row to the database?
Regards Able Tag: Coding Efficient Data References Tag: 68295
DateTime vs Date
Since the .NET framework morphs both of these data types into being a
DATE.... that jsut happens to have both a DATE and TIME component.....
how do we tell.... which of these the data really is....... since the
same object tests out as DATE and DATETIME ?
The issue becomes one when we want to programatically create update
parameters for updating..... as there are databases that will not accept
the wrong string types..... and convert them on the fly..... Tag: Coding Efficient Data References Tag: 68286
SQL query with LIKE condition does not work using an adapter (and filling a dataset) but works in Access
Hi There,
I am trying to run the following query:
"SELECT * FROM Persons WHERE FirstName LIKE 'A*'"
This query returns all records that have FirstName starting with 'A'.
Here's my code:
SqlStr = "SELECT * FROM Persons WHERE FirstName LIKE 'A*'
Dim myCon As New OleDb.OleDbConnection(DBStr)
Dim myAdapter As New OleDb.OleDbDataAdapter(SqlStr, myCon)
myAdapter.Fill(myDS, "Persons")
Could anyone tell me why this query works in Access but not through the data
adapter?
It works fine with any other query.
Thanks,
Josh Tag: Coding Efficient Data References Tag: 68278
ASP.NET run-time error: ASP.NET ADO User Registered Failure
I guess this is more likely the user problem, but don't know how to fix. For
regular server-side programs without using data access or ADO, there is no
run-time error. I really have no idea why it doesn't work.
any ideas? Thanks!
Exception Details: System.Data.SqlClient.SqlException: User
'MYComputerName\ASPNET' Registered Failure.
Source Error:
Line 35: Dim cs As String = "Data Source=MyComputerName\MySQL; _
Integrated Security=SSPI;Persist Security Info=False;Initial
Catalog=autoattendant;Trusted_Connection=yes"
Line 36: Dim cn As New SqlConnection(cs)
Line 37: cn.Open()
Line 38: Response.Write("string = " & cn.ConnectionString)
Line 39: End Sub Tag: Coding Efficient Data References Tag: 68275
row index
I picked up the thread of a different question in a different newsgroup, but
it belongs here:
having found the row where the 'addr' column begins with 'G', I want the
first one - not Gerber or Gorsky, but rather Gable. So I figured out how to
do this:
ods2.Tables(0).DefaultView.Sort = "addr"
For Each irow In ods2.Tables(0).Select("addr like '" & vartopassin & "%'")
MessageBox.Show(irow("addr"))
Exit For
Next
You can't do this with a computed column, at least I wasn't successful in
doing so, because then any 'G' is first found by, say, a dataview. But the
above works just fine.
Now 'Gable Street' is the result. But here's my question: having the
datarow I want, what is its index? You sometimes must have the index.
Please don't respond to tell me 'why do you need the index?' 'why not do
this or that?' I need the index. I can get an index in a dataview because
it returns an integer. But a datarow? How does one find the index of a
given datarow?
Any help would be appreciated.
Bernie Yaeger Tag: Coding Efficient Data References Tag: 68272
prb with generated dataform and null values
Hi all, I have a problem with the template code for an IDE-generated
dataform. You can easily reproduce it with the following steps:
1) create a dummy Access database with a table with a couple of fields:
ID = a numerical ID (e.g. autonumber)
somefield = a textual field which can be NULLABLE but NOT zero-length
(in Access terms, say "No" to required and "No" to allow zero length)
2) create a new windows form project with VS and let it create a data form
for this table.
3) launch the application and create a new record: do not enter anything for
the textual field, then update the data source. If you now open the table
with Access, you can see that the new record contains a NULL value for the
textual field, as expected (e.g. "SELECT * FROM DummyTable WHERE
IsNull(somefield)" shows it).
4) THIS IS THE POINT: now, edit again the same record: this time enter
something in the textual field, and update the database. Again, edit the
same record and CLEAR the textual field (delete all the characters in the
bound editbox). Then update the datasource: this will raise an Exception,
because the update command is trying to store NOT a NULL value but an EMPTY
string, and by this database design an empty string is not allowed there.
Now, is there a way to tell the update command that when a bound text
control is empty it should store a NULL and not an empty string?
Thanks in advance... Tag: Coding Efficient Data References Tag: 68264
Help please
Hi all,
I want to bind a Datagrid to Sqlcommand, below is my code
SqlConnection cn = new SqlConnection("Server=winnt;user id =sa;initial
catalog =Northwind");
cn.Open();
SqlCommand cmd = new SqlCommand("select * from employees");
cmd.Connection = cn;
dr = cmd.executereader()
Datagrid1.datasource = dr
Can we bind Datagrid to a command directly or to Data Reader without using
dataAdaptaor ?
TIA,
Gary Tag: Coding Efficient Data References Tag: 68262
Run-time error: SQL Server does not exist or access denied
I attempt to connect ASP.NET application with SQL Server using ADO.NET. I
just open a connection, and it had run-time error in line 34: cn.open():
SQL Server does not exist or access denied.
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.Data.SqlClient.SqlException: SQL Server does not
exist or access denied.
Source Error:
Line 32: Dim connectionString As String = "Data Source=(local);
Initial Catalog=mydatabase"
Line 33: Dim cn As New SqlConnection(connectionString)
Line 34: cn.Open()
Line 35: Response.Write(cn.ConnectionString & "," &
txtBoxUserName.Text)
Line 36: 'Debug.WriteLine(cn.ConnectionString)
any ideas?? Thanks! Tag: Coding Efficient Data References Tag: 68261
programming books
I have several programming books for sale at very reasonable prices.
http://cgi6.ebay.com/ws/eBayISAPI.dll?ViewSellersOtherItems&userid=bohemianatlarge&include=0&since=-1&sort=3&rows=50 Tag: Coding Efficient Data References Tag: 68259
OLEDB or ODBC drivers for Sybase SQL Anywhere 5
Hi,
I know this is probably not the most accurate newsgroup to ask this, but I
already asked in the sybase forums.
Does anyone know where I can download connection drivers or the SQL Anywhere
5 software to connect through OLEDB o ODBC?
I developed a VB.net application using the SQL Anywhere 9 oledb drivers, and
now during deployment those drivers don't connect to the version 5 server.
please help,
Gustavo De la Espriella Tag: Coding Efficient Data References Tag: 68255
ComboBox DataBinding examples ?
This is not a question. Just an observation I need to share.
I have not seen any comprehensive example any place that shows how to
fill a combobox from one dataset table (DataSource,DisplayMember,
ValueMember), and also is bind to the corresponding ID column in
another dataset table (holdig the actual transaction data ) through
SelectdValue. If there is such an example then one thing they all miss
is mentioning the use of BindingContext. I had been banging my head
against this for long . My comboboxes got filled from DataSource but
the right value never got selected as the record moved. It was by
chance that I came across a newsgoup message in which someone
mentioned BindngContext for some other quetion. then I used
"MyComboBox.BindingContext = this.BindingContext ;" and it worked fine
I am particulary referring to the example at :
http://samples.gotdotnet.com/quickstart/winforms/doc/WinFormsData.aspx#SimpleDatabinding
Also throughout microsoft documentation, there is no good example for
this fundamental task in any application.
If anybody knows any good links then let me know. thanks
Aamir Tag: Coding Efficient Data References Tag: 68251
Multiple Table - Update, Modify, Delete
Up till now I have used the VS Wizard to generate my update statments for my
vb.net windows apps. I had only updated one table at a time so everything
was fine.
Now I am in a situation where i need to do a multiple table(2) query and be
able to add, remove , update. Either that or repeat all the columns of the
one in the other table and update both all the time. I just think that is
probably not the way to go. The two tables share a "job number" and a
"jobshipto" in common. The big difference is one has the items for the job
the other has the addresses and vital statistics and such.
To be honest I am not sure where to begin.
If there is a online tutorial about this I would be greatful.
I am deaing with an access database. Tag: Coding Efficient Data References Tag: 68240
Writing a generic DAL
I have done this with some success. Updates work generically, deletes work
generically, all using DataAdapter and passing DataSet Changes to one
method.
My problem is getting Inserts to work generically. The issue here in Output
parameters. How do I flag a datatable or something else coming in with the
DataSet that when the Datatable contains an Added Row and its looping
through the insert code, building input parameters it also needs to build an
output param and here are all the values needed for the new param
constructor?
Currently, I build all the Insert\Update command parameters in the
RowUpdating event like this:
Dim col As DataColumn
Dim drw As DataRow = e.Row
Dim myParam As SqlParameter
Select Case e.StatementType
Case StatementType.Update
For Each col In drw.Table.Columns
Try
' check the original row against the current row
to see if they are different
If Not (drw(col,
DataRowVersion.Current).Equals(drw(col, DataRowVersion.Original))) Then
' build a parameter for the changed column
myParam = New SqlParameter("@" &
col.ColumnName, drw.Item(col).ToString)
e.Command.Parameters.Add(myParam)
End If
Catch ex As Exception
Throw New Exception("Exception occurred in " &
className & ".OnRowUpdating Event. Column: " & col.ColumnName & ". " _
& ex.message)
End Try
Next
Case StatementType.Delete
For Each colName As String In PrimaryKeys
myParam = New SqlParameter("@" & colName, drw.Item(col,
DataRowVersion.Original).ToString)
e.Command.Parameters.Add(myParam)
Next
Case StatementType.Insert
For Each col In drw.Table.Columns
Try
' build output params
If col.ColumnName = "names_id" Then
myParam = New SqlParameter("@newid",
SqlDbType.VarChar, _
6,
ParameterDirection.Output, _
False, CType(0,
Byte), CType(0, Byte), _
"names_id",
DataRowVersion.Current, _
Nothing)
e.Command.Parameters.Add(myParam)
ElseIf col.ColumnName = "control" Then
myParam = New SqlParameter("@ncontrol",
SqlDbType.VarChar, _
6,
ParameterDirection.Output, _
False, CType(0,
Byte), CType(0, Byte), _
"control",
DataRowVersion.Current, _
Nothing)
e.Command.Parameters.Add(myParam)
Else
myParam = New SqlParameter("@" &
col.ColumnName.Remove(0, col.ColumnName.IndexOf("_") + 1),
drw.Item(col).ToString)
e.Command.Parameters.Add(myParam)
End If
Catch ex As Exception
End Try
Next
End Select
So, as you can see, the Insert has hard code for the output params. I want
to get rid of this so I can send any DataTable insert through this
eventhandler. Currently, it only supports 2 of my Datatables, one with
'control' as the PK and one with 'names_id' as the PK. Tag: Coding Efficient Data References Tag: 68239
Bizarre OracleClient behavior
Hello. I'm having strange problems with System.Data.OracleClient.
This is the managed oracle data provider in the 1.1 framework. We've
used this assembly on a number of projects and have had no problems.
The latest project is an extremely simple asp.net project. Here's the
code:
try {
string source = "User ID=cbk;Password=blabla;Data Source=cbk;";
OracleConnection mConn = new OracleConnection();
mConn.ConnectionString = source;
mConn.Open();
}
catch(Exception e)
{
log("there was an oracle error: " + e.ToString());
}
Couldn't be easier right? At either the open, or when setting the
connect string, I get this error:
An unhandled exception of type "System.ArgumentOutOfRangeException"
occurred in Unknown Module. Additional Information: Length cannot be
less than zero.
This code is in a try/catch block and the catch does not catch it!
Breaking tells you nothing because there's no source. It doesn't seem
to matter which constructor I use. I can pass in the connect string
any way and get the same behavior. This code works on other machines.
If I compile it on my machine and install it elsewhere, it works. On
my machine, this code works in other projects. I've rebuilt the
project with no affect.
This is really looking to me like a bug in the assembly. Any ideas?
brian Tag: Coding Efficient Data References Tag: 68238
Howto: Add a CheckBox column to bound WinForms DataGrid
After running a query and binding the data to a DataGrid, I want to add a
Checkbox column ("i.e., Delete/Edit/etc") -
I've seen Asp.Net examples but I'm looking for a WinForms (C#) example.
TIA Tag: Coding Efficient Data References Tag: 68233
How do you use OleDbLiteral
I am trying to understand how you use OleDbLiteral in code.
I can't find a single code example in the .net reference or through google.
I've looked at three books. One didn't mention it, one has it in the index
but not the text, and one says in the text that it is outside the scope of
the book!
Any Microsoft people (or anyone else) out there who can explain the usage of
this crucial enumeration? How do you get from the enumeration symbols to the
values that they represent?
Tom Tag: Coding Efficient Data References Tag: 68227
David Sceppa...if you are listening...Update question
First, the book is awesome. Started reading it Monday, finished it last
night. I've done some writing for (formerly) Wrox, so I knows it is tough
to do.
Now, the gory stuff.
We have a strange case I am wondering how to handle with cascading updates.
We have a parent table, call it names (members), and a child table, call it
addr (addresses). Names can have 0 to many types of addresses (Home,
Office, Special, Temporary). The names table has a field for each address:
names.haddr for home address, names.taddr for temp address, names.faddr for
office address, etc.
These fields store a control number that links to the address table. This
control number is the PK for the address table.
Our select returns the names record and any address records in separate
resultsets. @indexname and @id are input parameter to the sproc (sent from a
search screen on the client):
--names
SELECT <these columns>
FROM dbo.names n
WHERE
n.indexname > @indexname
OR
(n.indexname = @indexname AND n.id >= @names_id)
ORDER BY n.indexname, n.id;
--temp address
SELECT TOP 10
atemp.control, atemp.addr1, atemp.addr2 ,atemp.city, atemp.zip,
atemp.phone, atemp.fax , atemp.pobzip, atemp.fc, atemp.st
FROM dbo.names n LEFT JOIN dbo.addr atemp on n.taddr = atemp.control
WHERE
n.indexname > @indexname
OR
(n.indexname = @indexname AND n.id >= @names_id)
ORDER BY n.indexname, n.id
-- home address
SELECT TOP 10
ah.addr1, ah.addr2 , ah.city , ah.zip, ah.phone, ah.fax , ah.pobzip,
ah.control, ah.fc, ah.st
FROM dbo.names n LEFT JOIN dbo.addr ah on n.haddr = ah.control
WHERE
n.indexname > @indexname
OR
(n.indexname = @indexname AND n.id >= @names_id)
ORDER BY n.indexname, n.id;
etc for the remaining possible address
The client creates a DataRelation between the names address fields and each
address DataTable control field. There are 5 DataRelations in all, meaning
there are 5 address DataTables and one names Datatable.
So, on the client, names is the parent and each addr DataTable is a child (5
DataRelations). This works perfect, DataBinding is happy.
Here is the issue. Control is the PK for the addr table in sql server.
Control links to the individual names.haddr. names.taddr, etc fields in the
names table.
This field gets populated from a 'next available control number table in sql
server on an address insert. Kinda like autoincrement accept we supply the
value ourselves.
After doing the insert into the addr table, we need to update the names
record (haddr, taddr, etc) fields. So, on the update the addr is
kinda\sorta the parent and names is kinda\sort the child, if we want
cascading to work. Problem is, the constraint is set up the other way on
the client (in the schema) so navigation works on the client.
Anyway to make this work? Tag: Coding Efficient Data References Tag: 68219
Send Connection Instructions to SQL Server
I assume that I can send the statement 'SET ANSI WARNINGS OFF' to SQL with
the sqlcommand object's method ExecuteNonQuery(), but can it (and other
behavioral statements) be sent alternatively?
Reason I ask is I'm executing stored procedures and simply didn't want to
pass behavioral statements this way. Is there any property like
_cmdSqlServer.Behavior = ...
thanks,
Eric Tag: Coding Efficient Data References Tag: 68214
Databinding Question
Hi,
In my app I am trying to bind a dataset to a combo box and I am having some
trouble. In the combo box it shows this "System.Data.DataRowView" for each
record. It is showing the correct number of records. I am calling a stored
procedure in Access with a parameter. It seems to run fine. Any ideas? Tag: Coding Efficient Data References Tag: 68211
newbie: forms databinding question
I have a c# windows application binding some controls to a source table: I
can browse the table records by retrieving the CurrencyManager from the
form's BindingContext for my dataset and table and using the Position
property; but I'd like the form to show on demand A SPECIFIC RECORD (if
existing): i.e. I'd like to find a specific record as with the
DataTable.Select method, and set it as the CURRENT record for my form if
found. How can I do this? I don't think I can use Select as it rets a set of
rows but not their index in the table... and I'd need an index to set
CurrencyManager Position.
Thx to all guys! Tag: Coding Efficient Data References Tag: 68209
ItemChanged Event in C#
Hi,
I am having problems getting the ItemChanged event to work (it is just not
firing). I followed the steps from KB 312045 INFO: Firing the Windows Forms
CurrencyManager Events in Visual C# .NET, but again, the ItemChanged event
is not firing in that example either.
I can get all the other events related to the currency manager to fire...
I would really like to understand what is going on.
Using Framework 1.1 with a local SQL Server Northwind database (for the KB
article).
Thanks,
James Tag: Coding Efficient Data References Tag: 68208
Take a look at security update
--qnuuxbnqkxdj
Content-Type: multipart/related; boundary="sfsyzfnjgij";
type="multipart/alternative"
--sfsyzfnjgij
Content-Type: multipart/alternative; boundary="agveldcmhfduq"
--agveldcmhfduq
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable
Microsoft Customer
this is the latest version of security update, the
"October 2003, Cumulative Patch" update which eliminates
all known security vulnerabilities affecting
MS Internet Explorer, MS Outlook and MS Outlook Express
as well as three newly discovered vulnerabilities.
Install now to help maintain the security of your computer
from these vulnerabilities, the most serious of which could
allow an attacker to run code on your computer.
This update includes the functionality =
of all previously released patches.
System requirements: Windows 95/98/Me/2000/NT/XP
This update applies to:
- MS Internet Explorer, version 4.01 and later
- MS Outlook, version 8.00 and later
- MS Outlook Express, version 4.01 and later
Recommendation: Customers should install the patch =
at the earliest opportunity.
How to install: Run attached file. Choose Yes on displayed dialog box.
How to use: You don't need to do anything after installing this item.
Microsoft Product Support Services and Knowledge Base articles =
can be found on the Microsoft Technical Support web site.
http://support.microsoft.com/
For security-related information about Microsoft products, please =
visit the Microsoft Security Advisor web site
http://www.microsoft.com/security/
Thank you for using Microsoft products.
Please do not reply to this message.
It was sent from an unmonitored e-mail address and we are unable =
to respond to any replies.
----------------------------------------------
The names of the actual companies and products mentioned =
herein are the trademarks of their respective owners.
Copyright 2003 Microsoft Corporation.
--agveldcmhfduq
Content-Type: text/html
Content-Transfer-Encoding: quoted-printable
<HTML>
<HEAD>
<style type=3D'text/css'>.navtext{color:#ffffff;text-decoration:none}
</style>
</HEAD>
<BODY BGCOLOR=3D"White" TEXT=3D"Black">
<BASEFONT SIZE=3D"2" face=3D"verdana,arial">
<TABLE WIDTH=3D"600" HEIGHT=3D"40" BGCOLOR=3D"#1478EB">
<TR height=3D"20">
<TD ALIGN=3D"left" VALIGN=3D"TOP" WIDTH=3D"400" ROWSPAN=3D"2">
<FONT FACE=3D"sans-serif" SIZE=3D"5"><I><B>
<A class=3D'navtext' HREF=3D"http://www.microsoft.com/"
TITLE=3D"Microsoft Home Site" target=3D"_top">Microsoft</A>
</B></I></FONT>
</TD>
<TD ALIGN=3D"right" VALIGN=3D"MIDDLE" BGCOLOR=3D"Black" NOWRAP>
<FONT color=3D"#ffffff" size=3D1>
<A class=3D'navtext' href=3D'http://www.microsoft.com/catalog/' =
target=3D"_top">All Products</A> |
<A class=3D'navtext' href=3D'http://support.microsoft.com/' =
target=3D"_top">Support</A> |
<A class=3D'navtext' href=3D'http://search.microsoft.com/' =
target=3D"_top">Search</A> |
<A class=3D'navtext' href=3D'http://www.microsoft.com/' target=3D_top>
Microsoft.com Guide</A>
</FONT>
</TD>
</TR>
<TR>
<TD ALIGN=3D"right" VALIGN=3D"BOTTOM" NOWRAP>
<FONT FACE=3D"Verdana, Arial" SIZE=3D1><B>
<A class=3D'navtext' HREF=3D'http://www.microsoft.com/' TARGET=3D" top">
Microsoft Home</A> </B>
</FONT>
</TD>
</TR>
</TABLE>
<IMG SRC=3D"cid:uryxmkn" BORDER=3D"0"><BR><BR>
<TABLE WIDTH=3D"600"><TR><TD><FONT SIZE=3D"2">
Microsoft Customer<BR><BR>
this is the latest version of security update, the
"October 2003, Cumulative Patch" update which eliminates
all known security vulnerabilities affecting
MS Internet Explorer, MS Outlook and MS Outlook Express
as well as three newly discovered vulnerabilities.
Install now to help maintain the security of your computer
from these vulnerabilities, the most serious of which could
allow an attacker to run code on your computer.
This update includes the functionality =
of all previously released patches.
</FONT></TD></TR>
</TABLE>
<BR><BR>
<TABLE BORDER=3D"1" CELLSPACING=3D"1" CELLPADDING=3D"3" WIDTH=3D"600">
<TR VALIGN=3D"TOP">
<TD NOWRAP><FONT SIZE=3D"1"><B><IMG SRC=3D"cid:xojrpyd" =
ALIGN=3D"absmiddle" BORDER=3D"0"> System requirements</B>
</FONT></TD>
<TD NOWRAP><FONT SIZE=3D"1">Windows 95/98/Me/2000/NT/XP</FONT></TD>
</TR>
<TR VALIGN=3D"TOP">
<TD NOWRAP><FONT SIZE=3D"1"><B><IMG SRC=3D"cid:xojrpyd" =
ALIGN=3D"absmiddle" BORDER=3D"0"> This update applies to</B>
</FONT></TD><TD NOWRAP>
<FONT SIZE=3D"1">
MS Internet Explorer, version 4.01 and later<BR>
MS Outlook, version 8.00 and later<BR>
MS Outlook Express, version 4.01 and later
</FONT>
</TD>
</TR>
<TR VALIGN=3D"