Any example to create a custom constraint?
Any example to create a custom constraint?
ForeignKeyConstraint and UniqueConstraint can not really fit my need.
DataTable.ColumnChanging and RowChanging events do not fit my need either.
Thanks for your help Tag: calculated data fields could not be converted Tag: 67180
Need help with a query
I'm having trouble getting a particular query to work with ADO.NET. I want
to create a query where a returned field contains a certain string depending
on the which of several boolean fields in the database is true. I need a
function that will work in both Access 2000 and SQL Server, but I can't get
anything to work properly. I used to be able to do this with the Switch()
function with DAO and Access97. Does anyone know of a way to do this now
with both Access 2000 and SQL Server?
- Don Tag: calculated data fields could not be converted Tag: 67177
OracleTransaction has no effect
Hi,
I use the OracleTransaction class. I use multiple OracleCommands
participating in the same OracleTransaction.
When one of the OracleCommands fail when executing and I do a rollback on
the OracleTransaction it does NOT rollback the previous commands. It seems
like the connection? is auto commiting each command I execute.
Does anyone know how to solve this?
Regards,
René Tag: calculated data fields could not be converted Tag: 67172
Binding the date field to textbox
Hi,
I have the problem with binding the textbox with date field in the table of
the dataset.
The problem is that if the entered text in the textbox isn't of the correct
type (for example "dfhd" instead of "12.6.2003"), the text gets
automatically overwritten by the old value. That way the user has to type
everything all over again instead of just correcting the entered value.
Is there a way to prevent old value to overwrite the entered text?
I used the following code to bind the textbox to a dataview...
Dim objBinding As New Binding("Text", ds.NETBill.DefaultView, "Date")
AddHandler objBinding.Format, AddressOf FormatDate
txtDatum.DataBindings.Add(objBinding)
...and following code to validate entered text...
Private Sub txtDatum_Validating(ByVal sender As Object, ByVal e As
System.ComponentModel.CancelEventArgs) Handles txtDatum.Validating
If Not ControlValue.CheckValue (txtDate, ControlValue.ETip.tDate,
ds.NETRacun.DefaultView(0)) Then
e.Cancel = True
End If
End Sub
Regards,
Taras Tag: calculated data fields could not be converted Tag: 67166
ADO OR ADO.NET
I am using VS.NET to develop one small software which based on Windowsforms.
The number of end user is less than 10. So I am wondering I should use ADO
or ADO.NET. Any suggestion is appreciated. Tag: calculated data fields could not be converted Tag: 67153
Record locking Strategies? (ADO.NET)
Due to the disconnected architecture of the ADO.NET model
which are the recomended strategies for application which
requires record locking (for example a Online Ticket
Application)?
Thanks
Bill Tag: calculated data fields could not be converted Tag: 67152
OracleClient special characters in column name
Hello
I am working with System.Data.OracleClient
How can I create a table with special characters in
column name ?
I have tried:
OracleCommand oCmd = new OracleCommand("CREATE TABLE
T1 ('_C1' number)");
oCmd.ExecuteNonQuery();
OracleCommand oCmd = new OracleCommand("CREATE TABLE
T1 (\"_C1\" number)");
oCmd.ExecuteNonQuery();
OracleCommand oCmd = new OracleCommand("CREATE TABLE
T1 (\\_C1 number)");
oCmd.ExecuteNonQuery();
OracleCommand oCmd = new OracleCommand("CREATE TABLE
T1 ({_}C1 number)");
oCmd.ExecuteNonQuery();
... but it does not work.
Thanks for replies. Tag: calculated data fields could not be converted Tag: 67151
Connection pooling in Oracle
Hi,
How can I implement connection pooling in Oracle? I used .NET Framework 1.0,
Oracle .NET Provider 1.0 and Oracle Database 9i
Thanks for the help...
Eka Tag: calculated data fields could not be converted Tag: 67149
Oracle .NET Provider 1.1
Hi all,
Where can I download Oracle .NET Provider 1.1? Is it available at all?
I need this because i got this error: "Failed to initialize distributed
transaction. Please see KB article Q322343."
I saw the KB already and it said that i need to download Oracle .NET
Provider 1.1 but I couldn't find it.
Thanks for help..
Eka Tag: calculated data fields could not be converted Tag: 67148
Problem with the OleDb.OleDbCommandBuilder
Hi all,
Since my experience with sql is just beginning to grow
i use the commandbuilder object to generate updatecommands deletecommands
insertcommands.
With first run th update works without a problem
when i call my update function again (changing the same row again) i get
"Concurrency violation: the UpdateCommand affected 0 records."
Exception
The debugger shows that the dataset.datatable.row.rowstate = modified
But the update simply doesn't work
Does anyone know what i am doing wrong ?
any help would be greatly appreciated
Thanks & regards
Sven
Code:
For i = 0 to ds.tables.count -1
da.SelectCommand = New OleDb.OleDbCommand("SELECT * FROM " &
ds.Tables(i).TableName, mConnection)
comm = New OleDb.OleDbCommandBuilder(da)
da.UpdateCommand = comm.GetUpdateCommand
da.DeleteCommand = comm.GetDeleteCommand
da.InsertCommand = comm.GetInsertCommand
rowsaffected = da.Update(ds.Tables(i))
Debug.WriteLine("Updated table: " & ds.Tables(i).TableName & " affected
rows: " & rowsaffected)
Next Tag: calculated data fields could not be converted Tag: 67144
Controls missing in the forms
Hi All,
I am developing an ERP Application in VB.Net. I have used a common
dataset and all the form level datasets are used the common dataset for the
"datasetname"property. But when I open the form, its dead slow to show the
design of the form. My system is P4, 256 MB RAM.
May I know the soluation for the same or welcome any suggestions?.
Also sometimes the control are missing while loading the form in the
design time. but the same control object is available in the genereated code
of the form.
Can u help me for the same??
Thanks,
Rethish Tag: calculated data fields could not be converted Tag: 67141
Reading Excel with ADO
Hello,
I have tried to read Excel spreadsheet through ADO. I used the sample code
provided by msdn.I don't know what the fuck is the matter with the code
cause I can't read the Excel. I tried similar system with Access and it
works fine. Here is the error and the sample code.
Error:
Microsoft OLE DB Provider for ODBC Drivers error '80040e37'
[Microsoft][ODBC Excel Driver] The Microsoft Jet database engine could not
find the object 'ASPTOC'. Make sure the object exists and that you spell its
name and the path name correctly.
/ASPTOC.asp, line 21
Code:
<%@Language=VBScript %>
<html>
<head>
<title> Displaying An Excel Spreadsheet in an Web Page </title>
</head>
<body bgcolor="#FFFFFF" text="#000000" >
<h1>ASP Table of Contents</h1>
<%
'Creates an instance of an Active Server Component
Set oConn = Server.CreateObject("ADODB.Connection")
'Connects to the Excel driver and the Excel spreadsheet
'in the directory where the spreadsheet was saved
strProvider = "Driver={Microsoft Excel Driver (*.xls)};
DBQ=C:\Inetpub\wwwroot\Testi_site\ASPTOC.xls;"
'Opens the connection to the data store
oConn.Open strProvider
'Selects the records from the Excel spreadsheet
strCmd = "SELECT * from `ASPTOC`"
Set oRS = Server.CreateObject("ADODB.Recordset")
'Opens the recordset
oRS.Open strCmd, oConn
'Prints the cells and rows in the table
Response.Write "<table border=1><tr><td>"
'Gets records in spreadsheet as a string and prints them in the table
Response.Write oRS.GetString (, , "</tr><td>", "</td></tr><tr><td>",
NBSPACE)
%>
</body>
</html>
It looks like ODBC error but I did the ODBC like instructed. I also
installed the .net framework and latest MDAC to the server. The sample code
instructions say that u should use Excel 98 or 2000. I'm using Excel 2002.
Can this be the problem?? I think i've tried everything but can't figure
this out. Can anyone please help me???
Thanks!
KS Tag: calculated data fields could not be converted Tag: 67138
Confused by one more piece of IBindingList
Thanks for all the help I've been getting working on understanding
IBindingList and data binding in general.
My understanding about IBindingList is that it's primary use is for binding
custom strongly typed collections to complex controls (primarily DataGrid)..
So by grouping the parts of the interface into their various functionality
I'm coming to grips with how it works, with one exception..
Datagrid doesn't have any searching ability AFAIK, so why does IBindingList
have functionality for searches? I know that it's optional, and doesn't
have to be implemented.. But every other piece of the interface maps to a
piece of the puzzle needed for the grid to be able to handle adding,
removing, editing rows of data, sorting them, and so on.
So is the search functionality actually used? And if so where?
I hope I'm not just being obtuse.. I'm just trying to make sure I don't
dismiss that section of the interface and then later find out it's used
internally by something else, and I've hosed things by not implementing it..
Thanks in advance (again)
William Rowland Tag: calculated data fields could not be converted Tag: 67133
How do I format datagrid column to short time?
In my VB.Net program I am populatating a datagrid column using an MS Access
database field that that contains data formated in "Short Time" (17:34).
Right now, the datagrid displays the entire date and time. I need only the
short time. How can I do this simply?
I dont't use ASP.
Thanks,
Gigi Tag: calculated data fields could not be converted Tag: 67128
Looking for dialog to browse available connections
Can anyone point me to a dialog box which will allow me to browse for an
ADO.NET (or ODBC) connection?
The user would select the provider (ODBC data source), the server, database
etc. Dialog would construct the connection string.
Thanks Tag: calculated data fields could not be converted Tag: 67127
Binding a SQL Image Column to an Image Control - Can I Avoid Saving The ByteStream/FileStream To Disk ?
This is a multi-part message in MIME format.
------=_NextPart_000_001E_01C385E1.A67BC190
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
I have a C#/ASP.NET/ADO.NET/SQL Server app that stores and retrieves =
images.=20
The problem is the ASP Image control binds to a file. When retrieving an =
image from SQL, I would really like to avoid saving the =
ByteStream/FileStream to disk, just to then read it back into the Image =
control.=20
Is there a way to avoid this?
// This is my current implentation. It works, but requires lots of disk =
i/o.
// Write the ByteArray to a FileStream and then the FileStream to disk.
iLen =3D mySqlDataReader.GetBytes(0, 0, myByteArray, 0, lBufSize);
FileStream myFS =3D new FileStream(@"c:\image.jpg", FileMode.Create, =
FileAccess.Write);
myFS.Write(myByteArray, 0, iLen);
ASPImage1.ImageUrl =3D @"c:\image.jpg";
Thanks in advance,
Ben
------=_NextPart_000_001E_01C385E1.A67BC190
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1170" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff background=3D"">
<DIV><FONT face=3D"Courier New" size=3D2>I have a C#/ASP.NET/ADO.NET/SQL =
Server app=20
that stores and retrieves images. </FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2></FONT> </DIV>
<DIV><FONT face=3D"Courier New" size=3D2>The problem is the ASP Image =
control binds=20
to a file. When retrieving an image from SQL, I would really like =
to avoid=20
saving the ByteStream/FileStream to disk, just to then read it back =
into=20
the Image control. <BR></FONT><FONT><FONT face=3D"Courier New" =
size=3D2>Is there a=20
way to avoid this?</FONT></DIV></FONT>
<DIV><FONT size=3D2><FONT face=3D"Courier New"><FONT><FONT=20
face=3DArial></FONT> </DIV></FONT></FONT></FONT>
<DIV><FONT face=3D"Courier New" size=3D2>// This is my current=20
implentation. It works, but requires lots of disk=20
i/o.</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2>// Write the ByteArray to a =
FileStream and=20
then the FileStream to disk.<BR>iLen =3D mySqlDataReader.GetBytes(0, 0,=20
myByteArray, 0, lBufSize);<BR>FileStream myFS =3D new =
FileStream(@"c:\image.jpg",=20
FileMode.Create, FileAccess.Write);<BR>myFS.Write(myByteArray, 0,=20
iLen);</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2>ASPImage1.ImageUrl =3D=20
@"c:\image.jpg";</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2></FONT> </DIV>
<DIV><FONT face=3D"Courier New" size=3D2>Thanks in advance,</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2>Ben</FONT></DIV>
<DIV><FONT face=3D"Courier New" =
size=3D2></FONT> </DIV></BODY></HTML>
------=_NextPart_000_001E_01C385E1.A67BC190-- Tag: calculated data fields could not be converted Tag: 67122
Cursors and ExecuteNonQuery
All,
Is it possible for ExecuteNonQuery to open a cursor? The
reason I ask is that I'm debugging a client's C# service
which is leaking cursors and eventually Oracle throws a
MAX CURSOR EXCEEDED exception and the service dies a
horrible death. It appears that the method that is the
main culprit calls several stored procedures which do
something like:
INSERT INTO FOO ( ... ) RETURNING FOO_ID;
The FOO_ID is setup in the C# as an output parameter and
additionally, the client never calls the Dispose method on
the Command object.
Additionally, the Command objects are used like so:
cmd = new OleDbCommand("sp1", cnx);
...
cmd.ExecuteNonQuery();
...
cmd = new OleDbCommand("sp2", cnx);
...
cmd.ExecuteNonQuery();
...
Would this technique cause cursor leaks? Thanks...
Matt Tag: calculated data fields could not be converted Tag: 67121
Not getting SqlException using DataReader
I'm using a SqlDataReader to call a proc that reads data. My call to
raiseerror has no effect. Below is the code. if i comment out the select
statement, my code behaves as expected.
CREATE PROCEDURE [dbo].[usp_Table1Read]
@id int
AS
--select * from table1 where IId = @Id
if (@@rowcount = 0)
begin
raiserror('an error occured', 10, 1)
return 50000
end
return 0
GO
using System;
using System.Data;
using System.Data.SqlClient;
namespace ReaderTest
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
Class1 c = new Class1();
c.DoWork();
}
public void DoWork()
{
try
{
//connection
SqlConnection connection = new SqlConnection();
connection.ConnectionString = "Persist Security Info=False;Integrated
Security=SSPI;database=MyDataBase;server=(local)";
connection.Open();
connection.InfoMessage += new
SqlInfoMessageEventHandler(this.MySqlInfoHandler);
//command
SqlCommand command = new SqlCommand();
command.CommandType = CommandType.StoredProcedure;
command.CommandText = "usp_Table1Read";
command.Connection = connection;
//create return parameter
SqlParameter p = new SqlParameter();
p.ParameterName = "@RetVal";
p.Direction = ParameterDirection.ReturnValue;
p.SqlDbType = SqlDbType.Int;
command.Parameters.Add(p);
p = new SqlParameter();
p.ParameterName = "@Id";
p.Direction = ParameterDirection.Input;
p.SqlDbType = SqlDbType.Int;
p.Value = "3";
command.Parameters.Add(p);
//get reader
SqlDataReader reader = command.ExecuteReader();
//look at return parameter (1)
Console.Write("Check 1: ");
Console.WriteLine(command.Parameters["@RetVal"].Value);
while(reader.Read()){}
reader.Close();
connection.Close();
//look at return parameter (2)
Console.Write("Check 2: ");
Console.WriteLine(command.Parameters["@RetVal"].Value);
}
catch(Exception ex)
{
Console.WriteLine(ex.ToString());
}
}
public void MySqlInfoHandler(object sender, SqlInfoMessageEventArgs e)
{
Console.WriteLine("************************");
Console.WriteLine(e.Message);
Console.WriteLine("************************");
}
}
} Tag: calculated data fields could not be converted Tag: 67120
Referencing datarow/datareader values by property name vs index - How big a hit?
I've read several times that there is a performance hit when referencing
column values in ADO.Net by property name vs index number. Could someone
clue me in to how serious a hit this is, and maybe point me towards an
explanation as to the extra steps involved in referencing by name that are
causing the slowdown?
i.e.
variable=datareader(3)
is faster than
variable=datareader("LastName")
I hate giving up readability in my code (my code documentation skills are
bad enough already), and I've also got a paranoia of the order of columns
somehow getting shifted around. (I know when I bind a table to a datagrid,
the column order doesn't always match the order in the table..)
Any comments?
Thanks,
W.G. Rowland Tag: calculated data fields could not be converted Tag: 67116
Cannot find rows with GUID
Hello All
I have a table with column ID that is a uniqueidentifier. However I
can't seem to use the Find method of the Rows to located a GUID row.
For e.g. I'm passing a GUID string as
"{2446AF50-386F-4EC6-9E3D-44C4F1ACBF70}" and then using this to locate
the row
//Initialization ....
oDAProjectData.Fill(oDS);
DataTable tbl = oDS.Tables["PData"];
tbl.PrimaryKey = new DataColumn[]{tbl.Columns["ID"]};
// In update method...somewhere in code
DataRow dr = oDS.Tables["PData"].Rows.Find(new Guid(projID));
However, dr is evaluating to null so I can't update the row. Any ideas
what might be wrong here.
thanks
Sunit Tag: calculated data fields could not be converted Tag: 67103
clear a value from combo
i can do a clear and i clear all the items of my combo but the selected
value stay
how could i remove it. i've tried to remove each item but i have a problem
of data type between integer and string Tag: calculated data fields could not be converted Tag: 67102
read a combo binded by code
i can bind a combo by coding with somethin' like that:
Me.ComboBox1.DataSource = dataset
Me.ComboBox1.DisplayMember = "tabla.Descripcion"
Me.ComboBox1.ValueMember = "tabla.idPublicoObjetivo"
but i can't read it:
i think it should somethin' like:
Me.Label1.Text = Me.ComboBox1.SelectedText.ToString
Me.Label2.Text = Me.ComboBox1.SelectedValue
but it doesnt work. Tag: calculated data fields could not be converted Tag: 67088