how to return stored procedure error?
hiye, does anyone know how to return a stored procedure
error to vb.net?
any or all error capture in stored procedure i want em to
be return to vb.net.
thanks for the help.. Tag: how to do transaction Tag: 76428
"One or more accessor flags were invalid." -- VFPOLEDB
I am trying to do a simple Asp.Net update using the same OleDb code
that has worked for Access databases, and I get this error message
when using a Visual Foxpro database: "One or more accessor flags were
invalid." It retrieves data ok, but won't update it.
Anyone know why? Thanks. Tag: how to do transaction Tag: 76418
Table Names with Spaces
I wrote a program that inserts records into a table in a MS Access
database. For some reason, it works only for tables without spaces in
their names:
There are four tables: "test 1" "test2" "test 3" and "test4" each with
fields word, pos, and meaning.
The following code works only for test2 and test4, the tables whose
names do not contain any spaces.
string tableName="test 1"; //place table name here
OleDbConnection conn=new
OleDbConnection("provider=microsoft.jet.oledb.4.0;data
source=lists.mdb");
OleDbDataAdapter da=new OleDbDataAdapter("select * from
["+tableName+"]",conn);
OleDbCommandBuilder cb=new OleDbCommandBuilder(da);
DataSet ds=new DataSet();
da.Fill(ds);
conn.Close();
DataTable dt=ds.Tables[0];
DataRow dr=dt.NewRow();
dr["word"]="myword";
dr["pos"]="mypos";
dr["meaning"]="mymeaning";
dt.Rows.Add(dr);
try
{
da.Update(ds);
}
catch(OleDbException ole){Console.WriteLine(ole.Message);} Tag: how to do transaction Tag: 76415
OleDb versus (Sql,Oracle,Odbc etc..)
Is there a peformance difference when using OleDB classes
instead of SqlServer? Or are the differences mainly
functional, for example SqlServer lets you perform more
of its proprietry functions using it's classes. Any help
appriciated! This question is the same for Oracle, Odbc
and any other specific .NET provider...
Thanks, Robby Tag: how to do transaction Tag: 76410
possible to step into a stored procedure
Hi-
when debugging, is it possiblt to step into a stored procedure? For
example, if I have a method in my DAL class called AddProduct() and it makes
a call to SqlCommand.ExecuteNonQuery() can I step into that sproc that it
will be calling? I hope so, that would be the coolest!
OK, if this is possible and you know how, please do share.
Thanks,
Steve Tag: how to do transaction Tag: 76404
Why aren't there any interfaces??
I'm working with DataSets in my code and cannot find a suitable Interface to
reference.
As a work-around, I've written an Interface (IDataSet) that defines all of
the public method signatures of a DataSet class. A custom class (DataSetExt)
implements that Interface and delegates public method calls to *base*.
I know that in taking this approach I've left myself open to a slew of
potential problems especially if the signatures of the DataSet class change.
However, the System.Data.DataSet class has no primary interface....????
Any thoughts on this?
thx Tag: how to do transaction Tag: 76399
SqlParameter SqlDBType.text size
What is the correct way to address the size of a SqlDBType.text field in a
SqlParameter
The Data Adapter configuration wizard does this
cmdUpdate.Parameters.Add("@myvar", SqlDbType.Varchar, 2147483647)
Is that right (I'm assuming so), but could I also do this? (using
SqlDbType.Text)
cmdUpdate.Parameters.Add("@myvar", SqlDbType.Text, 2147483647)
or even this, as the size is defined in Sql server
cmdUpdate.Parameters.Add("@other_accident_cause", SqlDbType.Text, 16)
Little confused here.. :)
--Michael Tag: how to do transaction Tag: 76397
Speeding up a Directory Search Process
This is a multi-part message in MIME format.
------=_NextPart_000_00D6_01C3D46F.A23E0DE0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
I having trouble querying for users that have changed, when I have a =
node that have over 750 users. It takes way to long over 1 hour, if it =
does return users. How can I improve this?
objADSDirEntry =3D New DirectoryEntry(sInADSADsPath, strADSUserName, =
strADSPassword, AuthenticationTypes.ServerBind)
ObjADSDirSearcher =3D New =
DirectoryServices.DirectorySearcher(objADSDirEntry)
Err.Clear()
ObjADSDirSearcher.Filter =3D =
"(&(|(objectClass=3Duser)(objectClass=3Dgroup)(objectClass=3Dcontact))(&(=
uSNChanged>=3D" & LastMod & ")(uSNChanged<=3D" & NewLastMod & ")))"
'ObjADSDirSearcher.PageSize =3D 1000
ObjADSDirSearcher.ServerTimeLimit =3D TimeSpan.FromMinutes(3)
For Each objSearchResult In ObjADSDirSearcher.FindAll
objadsDirEntry2 =3D objSearchResult.GetDirectoryEntry
Thanks
Robert
------=_NextPart_000_00D6_01C3D46F.A23E0DE0
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.1126" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I having trouble querying for users =
that have=20
changed, when I have a node that have over 750 users. It takes way to =
long over=20
1 hour, if it does return users. How can I improve this?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>objADSDirEntry =3D New =
DirectoryEntry(sInADSADsPath,=20
strADSUserName, strADSPassword, =
AuthenticationTypes.ServerBind)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>ObjADSDirSearcher =3D New=20
DirectoryServices.DirectorySearcher(objADSDirEntry)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Err.Clear()</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>ObjADSDirSearcher.Filter =3D=20
"(&(|(objectClass=3Duser)(objectClass=3Dgroup)(objectClass=3Dcontact)=
)(&(uSNChanged>=3D"=20
& LastMod & ")(uSNChanged<=3D" & NewLastMod &=20
")))"</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>'ObjADSDirSearcher.PageSize =3D =
1000</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>ObjADSDirSearcher.ServerTimeLimit =3D=20
TimeSpan.FromMinutes(3)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>For Each objSearchResult In=20
ObjADSDirSearcher.FindAll</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>objadsDirEntry2 =3D=20
objSearchResult.GetDirectoryEntry</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Thanks</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Robert </FONT></DIV></BODY></HTML>
------=_NextPart_000_00D6_01C3D46F.A23E0DE0-- Tag: how to do transaction Tag: 76392
ConnectionString: set ANSI NULL on/off
I want to know if there is a way to specify ANSI NULL
processing ON/OFF, based on a ConnectionString parameter.
This will take care of processing "x = NULL" and "x IS
NULL" kind of SQL expressions appropriately based on the
ON/OFF setting.
I expect to set this like:
ConnectionString="Provider=...; ANSI_NULL=no";
OR
ConnectionString="Provider=...; Extended
Properties="ANSI_NULL=no;"
This is for connecting to Sybase, using Ole DB classes.
TIA
Raj
"Operator... Get me outa here." Tag: how to do transaction Tag: 76385
Getting a RecorSet returned by a SP
Please,
how can i get and read a RecordSet returned by a SQL SERVER stored
procedure?
Tks in adv.
Fabiano Tag: how to do transaction Tag: 76377
Navigation in DataGrid
Hallo
I have a DataGrid that shows records from my database and allow the user to
navigate to the children records (i.e. press on the + sign and then on the
DataRelation name to navigate to the corrosponding rows)
Anyway the DataRelation names are not very user-friendly. My client expects
something more discriptive than "credit2details".
How can I change only these tabs without to change all the DataRelation
throughout the whole project
thanks in advance Tag: how to do transaction Tag: 76373
.Tif Pictures
I got some .tif pictures that I used in ACCESS.
I am trying to use these pictures in VB.NET. Do
I have to switch these pictures format over to something
else or is there a way I can use them? Tag: how to do transaction Tag: 76365
Abstracting field names in strongly-typed datasets?
I'm working with a table that has poorly-named fields which I cannot
change:
dptnum
dptname
I'm creating a strongly-typed DataSet to work with the data in this
table, and I would much rather that my DataSet have fieldnames of:
DepartmentNumber
DepartmentName
Is there some way to accomplish this without modifying the original
table? some sort of "alias" that I can add to the elements in the
XSD?
I considered using a Sql Server view to accomplish this, but views do
not have primary keys, and so the DataSet would have problems with
Update commands.
I look forward to your suggestions. Thanks! Tag: how to do transaction Tag: 76362
Updating and Access table with more than 127 columns
Due to an existing limitation of Access, you cannot issue
an UPDATE query with more than 127 fields (Access has a
limit of 255 fields and during an update query, both the
column your are updating and the value your are inserting
are treated as fields, which therefore limits you to
having 127 columns in your query).
ADO didn't have a problem with this if you used a
connected recordset (I'm assuming because it uses cursors
or something). Since updates are submitted via UPDATE
queries in ADO.NET this becomes an issue.
Making the table have less than 127 columns is not an
option as there are existing implmentations of the
database (using old clients that used VB and ADO that
worked...).
Only updating the 'changed' fields does not solve the
problem as the problem still exists when you change more
thant 127 fields...
There are issues with splitting the UPDATE into 127 field
chucks if some of the fields more then one chunk are
marked as 'required'.
My question is, is there any way to deal with this issue
in ADO.NET? I don't want to have to resort to using
interop and old ADO recordsets but it appears to me like
this is the only way to deal with this issue in a generic
way.
Thanks
Wayne Tag: how to do transaction Tag: 76355
Configuration File
Hello, I was wondering where I might find a "sample" application
configuration file for a windows applications.
What should the file be named.... ApplicationName.config ?
I am have created web applications and the system automatically generates a
"template" configuration file. Can the system generate a template file for
windows applications?
In a web application I use the method ConfigurationSettings.AppSettings
("ConnectStr") to obtain my configuration settings. Will I still be able
to use the same method?
Thanks in advance for your assistance!!!!!!!! Tag: how to do transaction Tag: 76353
IDataReader - cannot read
I have a method in my datalayer that returns IDataReader.
When I call this method it returns the datareader but when
I try to read it , gives me following error: any idea ?
thanks in advance
------------------
Error description:
------------------
An unhandled exception of
type 'System.Runtime.Remoting.RemotingException' occurred
in mscorlib.dll
Additional information: This remoting proxy has no channel
sink which means either the server has no registered
server channels that are listening, or this application
has no suitable client channel to talk to the server. Tag: how to do transaction Tag: 76351
HELP serious performance degradation compared to QA
I have a stored procedure that takes 4 seconds to execute (returning 3840 rows)
from Query Analyser, yet when I fill it using the following (assume the variable
SQL is the stored procedure)
Dim cmd As SqlCommand
Dim ds As New DataSet
Dim sa As SqlDataAdapter
cmd = New SqlCommand(SQL, cn)
sa = New SqlDataAdapter(cmd)
sa.Fill(ds)
it times out or takes much, much longer than 4 seconds - on the order of a
minute. This delay has a lot of corresponding server processor activity but
absolutely none for the client.
I've read some previous posts about timeout issues, but none of them explain
this performnace degradation. All I want is the data, and no extra overhead. Is
there any way in .Net I can get the *same* performance that I get from QA?
The same problem happens in VB6 using recordsets - the 4 second query takes 62
seconds.
I already looked at the DataSetSurrogate and it performance is worse.
http://support.microsoft.com/?id=829740
DataReader shows the same behavior/problem, only it times out at 30 seconds and
reports "system error".
Someone please help.
TIA,
Bob Tag: how to do transaction Tag: 76350
Fill a DataTable in a Class from another Class
Hi,
I need to fill a dataset in a form and automatically take affect in other
form.
For example:
I have a DataGrid attached to a DataTable in Form1 and I'm adding a record
in the same DataTable, but this time from Form2 and it doesn't take effect
in form1.
Please help me Tag: how to do transaction Tag: 76348
Pros and Cons of MS Data Access Application Block?
Is the Microsoft Data Access Application Block worth using? I'm new to it
and would like to get the opinions of some seasoned veterans. I'm not sure
it if will really save me very much time or effort. Thanks
--
Dave Veeneman
Chicago Tag: how to do transaction Tag: 76345
Performance Monitor Connection Pools
I have done some reading and figured that i can determine
the number of connections in my data pool.
i.e. http://techrepublic.com.com/5100-6329_11-5034285-
2.html
My question relates to performance monitor. While adding
the counters to performance monitor there is a selection
box for "Instance". I see a couple of my applications in
this instance box however, i do not see the web
application that I would like to measure. I see a
number of w3svc/xx/xxx instances. How do i determine
which w3svc instance is the one i need to track?
I also have read that I should take the results with a
grain of salt. That is fine.
Any help is greatly appreciated.
dave Tag: how to do transaction Tag: 76344
Browsing records from a specific location
Hi,
I've created a Data Form with the Wizard (Under VB.net
and MS Access)
I can browse the records with the buttons( movefirst,
movelast,move previous,...).
If I want to move to a specific location like where
costumersID=5 for example, and then continuing browsing
the records with the buttons from that position.
How can it be done?
Thanks in advance,
Luis Mendes Tag: how to do transaction Tag: 76343
Gotcha
Just so you know scorp I am downloadeding it and am going
to try it out.
I hope you did better on this one than the last thing you
published!! I am sure you learned your lesson this
time.... (ROFLMAO)
Glad to see you came back...... I knew you would if I
went away :)
Did the rest of the group miss me? (ROFLMAO!!!!!)
>-----Original Message-----
>This morning I let the group know that I had finished an
application that
>categorizes posts in the vb.net and ado.net newsgroups
and eliminates the
>trash that we hate to wade through on sites like Google
and such.
>
>Well I would like to thank the multitude of you that
have emailed me
>informing me of the bug in the datagrid (the scrollbars
don't show up unless
>you resize the form after populating the grid).
>
>I knew you would be a tough audience but geez :)
>
>Actually I appreciate you letting me know. It is the
inital release of this
>so I expected things like this.
>
>The bug is now fixed. The corrected version is 1.06. It
should automatically
>remove your previous version but may not because the
installer can be buggy.
>
>You can download the fixed version at
>http://www.kjmsolutions.com/newsgrouptool.htm
>
>
>
>
>
>.
> Tag: how to do transaction Tag: 76341
ASP.NET Automatic vs. Manual ado.net objects
Hello,
I'm hoping someone here can help me out with this. I'm programming with
asp.net within the VS.NET IDE. I've found two different ways to handle data
access, I can program my own ado.net components, or drag and drop from the
toolbox connections, adapters, datasets, etc. to the design view of the web
form.
I like the drag and drop features, but would like to know more about it, I
kind of just stumbled on it, and never really found a good document
explaining it.
Does anyone out there have experience with this, and could offer any
insight. Any showstoppers someone has run into from using the automatic
stuff versus do-it-yourself. In the long term what will be the best option?
Thanks for any help!
--Michael Tag: how to do transaction Tag: 76335
Row Cell
Hello, Coming from VB, accessing cells is a little different in C#.
If I have a datatable, I see the ItemArray propery, which gives you an
array of the items in a row (right?), but it does not allow you to access
the individual cell. Do I have to get the ItemArray and access the
individual cell from that, or is there another way. In VB there was the
"item" property.
dt.rows[myRow].item[2] = "Fred"
If I have a Datarow is there a property that tells me the index of that row
in a DataTable?
Likewise, if I have a DataRowView Row, is there a property which tells me
the index of that row?
Thanks in advance for your assistance!!!! Tag: how to do transaction Tag: 76329
optimistic concurrency
In the .NET Data Access Architecture Guide, under Performing Database
Updates with DataSets | Managing Concurrency, it says there are four main
approaches to manage optimistic concurrency when updating through a DataSet:
1. Including only the primary key columns
2. Including all columns in the WHERE clause
3. Including unique key columns and the timestamp columns
4. Including unique key columns and the modified columns
Then it goes on to say that 1, 2, and 4 are not recommended -- even though 2
is the default behavior of the Data Adapter Configuration Wizard, and 3 is
NOT supported by the Data Adapter Configuration Wizard. I think "ironic" is
the applicable word here.
What is a good way to implement optimistic concurrency, then? Is everyone
putting a timestamp column in the tables, and leaving the Data Adapter
Configuration Wizard to RAD hackers? ;-)
Brad Williams Tag: how to do transaction Tag: 76306
SQLDataAdapter SP Generation
Hi,
I have created an SQLDataAdapter component on my vb.net winform project and
stepped through the wizard. In my SQL Database I have a table with fields
using user defined data types and not the base data types. The problem is
that when the stored procedure gets created by the adapter the parameter's
data types did not follow the data type of the table I used in the wizard.
Is there any solution on how I could use my user defined data types in my
SP, autogenerated by the adapter, w/o actually modifying the SP after
running the wizard?
Appreciate any help.
Thanks.
Ramil Domingo
Developer Tag: how to do transaction Tag: 76304
Unspecified error when performing operations on OLE DB data adapters
I have 7 data adapters connected to MS Access tables. When I try to 1)
Preview Data or 2) Generate DataSet or 3) look at the Mapping collection in
the DA Properties I get "Unspecified Error". Plus one of the data adaptors
generates a bad Update statement that throws an error message when I try to
update after a dataset Merge. None of the other adapters throw an Update
error.
I have tried reconfiguring, recreating and virtually every property
parameter without luck. I have recreated the MS Access table from which the
bad Update command is created. I have deleted the entire form containing the
data adapters and started over again with the same result.
Any thoughts?
Best regards,
Drew Yallop Tag: how to do transaction Tag: 76286
help with simple ado code
Hey all, hoping you can help with this odd problem...hopefully I am
just doing something really stupid. I have a small access database
with a bunch of text fields, and I want to insert a row, using the
following code:
OleDbConnection conn = new OleDbConnection(
@"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\moneymakin.mdb");
String stmt = "INSERT INTO Person (FirstName,
LastName, Email, LoginID, Password) VALUES (" +
"'" + this.m_perFirstName + "',
'" + this.m_perLastName +
"', '" + this.m_emailAddress + "',
'" + this.m_loginID +
"', '" + this.m_password +
"')";
MessageBox.Show(stmt);
//conn.Open();
OleDbCommand perCommand = new OleDbCommand(stmt,
conn);
perCommand.Connection.Open();
perCommand.ExecuteNonQuery();
//OleDbDataReader perReader =
perCommand.ExecuteNonQuery();
//perReader.Close();
conn.Close();
I get the following error msg when I run this update:
System.Data.OleDb.OleDbException: Syntax error in INSERT INTO
statement.
at
System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32
hr)
at
System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS
dbParams, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object&
executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior
behavior, Object& executeResult)
at
System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior
behavior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteNonQuery()
at WindowsSample.Person.saveNewData() in c:\Documents and
Settings\Kirk Gray\My Documents\Borland Studio
Projects\WindowsSample\DataItems\Person.cs:line 192
at WindowsSample.PersonalInfo.btnPersonalSave_Click(Object sender,
EventArgs e) in c:\Documents and Settings\Kirk Gray\My
Documents\Borland Studio
Projects\WindowsSample\Forms\PersonalInfo.cs:line 326
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m,
MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message&
m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message&
m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32
msg, IntPtr wparam, IntPtr lparam)
I have no clue what the problem could be, but I know that when I only
use firstname, lastname, and emailaddress, the query works fine.
What could the problem be?
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =--- Tag: how to do transaction Tag: 76285
Row Number
If I have a Row from a dataTable, how do I get the row number of the row?
Thanks in advance for your assistance!!!!! Tag: how to do transaction Tag: 76282
Access Insert Error
I am trying to run the following insert into an Access DB. For some reason
I continually get a Syntax error in INSERT INTO statement. I have been
looking at it way too long. There has got to be something relatively
obvious that I am missing. Any suggestions would be greatly appreciated.
conDb = New OleDbConnection( strConString )
'Set up insert statement for order header
strSql = "Insert Orders (UserID, FirstName, LastName, billStreet, billCity,
billState, billZip, " & _
"shipStreet, shipCity, shipState, shipZip) VALUES (?, ?, ?, ?, ?, ?,
?, ?, ?, ?, ?)"
cmdSql = New OleDbCommand( strSql, conDb )
cmdSql.Parameters.Add( "@userID", OleDbType.Guid).Value = guidUserID
cmdSql.Parameters.Add( "@firstname", OleDbType.VarWChar).Value =
txtfirstname.Text
cmdSql.Parameters.Add( "@lastname", OleDbType.VarWChar).Value =
txtlastname.Text
cmdSql.Parameters.Add( "@billStreet", OleDbType.VarWChar).Value =
ctrlBillingAddress.Street
cmdSql.Parameters.Add( "@billCity", OleDbType.VarWChar).Value =
ctrlBillingAddress.City
cmdSql.Parameters.Add( "@billState", OleDbType.VarWChar).Value =
ctrlBillingAddress.State
cmdSql.Parameters.Add( "@billZip", OleDbType.VarWChar).Value =
ctrlBillingAddress.Zip
cmdSql.Parameters.Add( "@shipStreet", OleDbType.VarWChar).Value =
ctrlShippingAddress.Street
cmdSql.Parameters.Add( "@shipCity", OleDbType.VarWChar).Value =
ctrlShippingAddress.City
cmdSql.Parameters.Add( "@shipState", OleDbType.VarWChar).Value =
ctrlShippingAddress.State
cmdSql.Parameters.Add( "@shipZip", OleDbType.VarWChar).Value =
ctrlShippingAddress.Zip
conDb.Open()
cmdSql.ExecuteNonQuery()
The stack trace is as follows:
[OleDbException (0x80040e14): Syntax error in INSERT INTO statement.]
System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32 hr)
+41
System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS
dbParams, Object& executeResult) +174
System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
+92
System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior,
Object& executeResult) +65
System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior
behavior, String method) +112
System.Data.OleDb.OleDbCommand.ExecuteNonQuery() +66
Thanks,
J. Clay Tag: how to do transaction Tag: 76278
Viewing SQL Server system procedures?
Does MSDE include SQL Server's system procedures? If so, can I view/execute
them from the Server Explorer in VS.Net? If so, how? Thanks
--
Dave Veeneman
Chicago Tag: how to do transaction Tag: 76277
DataReader efficiency
I noticed that the datareader has a way to reference returned fields by
index or name. Is using the name parameter very inefficient?
It seems that if the stored procedure is modified to have the fields in a
different order, then using the name as an index would avoid problems.
What are other peoples thoughts and experiences on this?
Thank you,
Ken Tag: how to do transaction Tag: 76275
DB data into a custom list...
Hi,
As I've decided to use my own custom collections to get data from my DB
backend, to a web service, and then to my client frontend, I was wondering
if there is a way to directly fill the objects of my collection without
first having to load into a DataSet.
Could I override the SqlDataAdapter.Fill method so instead of
dbAdapter.Fill(dataSet, "site"), I have dbAdapter.Fill(myList, "site"), and
then the Fill would simply map the fields of each row onto the object fields
followed by adding them to the list?
What about SqlDataReader, does that give me any more options?
Is this a reasonable idea, or should I get my coat?
Thanks in advance
Colin B Tag: how to do transaction Tag: 76274
Inserting dates into SQL Server DB
I'm running the following code in a C#.NET page and it doesn't enter the
values into the DB. I'm certain the problem is to do with the txtBirth
field. It allows users to enter a DOB as dd/mm/yyyy and I think it's the
slashes(/) that are causing the problem. If I don't enter a DOB in this
field then all the data enters into the database without a problem.
Any ideas?
SQL Server 2000, VS.NET, C#
if (Page.IsValid)
{
// Save the new user to the database
SqlConnection con;
string sql;
SqlCommand cmd;
StringBuilder sb = new StringBuilder();
ArrayList values = new ArrayList();
sb.Append("INSERT INTO [User] ");
sb.Append("(UserID, Login, Password, FirstName, LastName, ");
sb.Append("PhoneNumber, Email, IsAdministrator, Address, ");
sb.Append("CellNumber, DateOfBirth) ");
sb.Append("VALUES ('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}',
");
// Optional values without quotes as they can be null
sb.Append("{8}, {9}, {10})");
// Add required values to replace
values.Add(Guid.NewGuid().ToString());
values.Add(txtLogin.Text);
values.Add(txtPwd.Text);
values.Add(txtFName.Text);
values.Add(txtLName.Text);
values.Add(txtPhone.Text);
values.Add(txtEmail.Text);
values.Add(0);
// Add the optional values or Null
if (txtAddress.Text != string.Empty)
values.Add("'" + txtAddress.Text + "'");
else
values.Add("Null");
if (txtMobile.Text != string.Empty)
values.Add("'" + txtMobile.Text + "'");
else
values.Add("Null");
if (txtBirth.Text != string.Empty)
values.Add("'" + txtBirth.Text + "'");
else
values.Add("Null");
// Format the string with the array of values
sql = String.Format(sb.ToString(), values.ToArray());
// Connect and execute the SQL
con = new SqlConnection("data source=127.0.0.1;initial catalog=Friends; user
id=sa;");
cmd = new SqlCommand(sql, con);
con.Open();
bool doredirect=true;
try
{
cmd.ExecuteNonQuery();
}
catch
{
doredirect = false;
this.lblMessage.Visible = true;
//this.lblMessage.Text = "Insert couldn't be performed. Username may already
be taken.";
this.lblMessage.Text = sql;
}
finally
{
con.Close();
}
if (doredirect)
Response.Redirect("Login.aspx");
}
else
lblMessage.Text = "Fix the following errors and retry:";
} Tag: how to do transaction Tag: 76267
ADODB.Query Interface failed
hello,
I'm getting this Error when using a reference to ADODB.DLL
Error#: 13
Error desc: QueryInterface for interface ADODB._Command
failed
can someone help me figure this out?
thanks
aj Tag: how to do transaction Tag: 76255
changing Dataset column order
Hi,
I am using a SP to fill a dataset and it has 5 columns
and data in it. I want to reorder the columns to
oldDs --> newDS
col1 --> col2
col2 --> col3
col3 --> col1
col4 --> col4
Anybody has idea of how to do this in best possible way?
A code snippet would be highly appreciated.
Thanks in advance
Bravo Tag: how to do transaction Tag: 76254
Grouping data at dataset level
Hi,
I have a SP and I am getting data in a dataset.
The datatable in dataset is having 5 columns and out of 5
columns, data in 2 columns has composite unique value.
Now I have to group the data based on these two column's
value. Can anybody tell me how to do this??
I want to minimize the looping. A code sample would be
highly appreciated.
Thanks in advance
Bravo Tag: how to do transaction Tag: 76253
Turning off connection pooling in VS.Net Server Explorer?
Is there a way to turn off connection polling in VS.Net's Server Explorer?
For debugging purposes, I'd like to create a connection with Pooling=False,
but I don't see this option in the Data Link property pagers, and the
connection string it creates is read-only in my version (Professional) of
VS.Net. Can I turn pooling off in a Server Explorer Data Connections object?
Thanks
--
Dave Veeneman
Chicago Tag: how to do transaction Tag: 76250
Primary column constrain programmatically
How can I add Primary column constrainst on a DataTable
Column in the program (C# or VB). Is the Unique property
on DataColumn same as Primary cpnstraint.
I need this because I need to Find() values in a
DataColumn which is not a primary column in the
DataSource. I want to make it a primary coulmn on the fly
and search through it. What other option do I have to
search through a column which is not a Primary column
besides iterating through the DataRowCollection.
thanks
Aamir Tag: how to do transaction Tag: 76246
Auto-Create Parameters?
Does anyone have any good tips for coding lots of input parameters?
I was wondering if there any tool out there that will auto-generate
parameters for me, so I could point it at a database table and it would
create for me everything except the values I'd assign them.
Thanks,
--Michael Tag: how to do transaction Tag: 76244
(Search Tool) Alright Already I Fixed It :)
This morning I let the group know that I had finished an application that
categorizes posts in the vb.net and ado.net newsgroups and eliminates the
trash that we hate to wade through on sites like Google and such.
Well I would like to thank the multitude of you that have emailed me
informing me of the bug in the datagrid (the scrollbars don't show up unless
you resize the form after populating the grid).
I knew you would be a tough audience but geez :)
Actually I appreciate you letting me know. It is the inital release of this
so I expected things like this.
The bug is now fixed. The corrected version is 1.06. It should automatically
remove your previous version but may not because the installer can be buggy.
You can download the fixed version at
http://www.kjmsolutions.com/newsgrouptool.htm Tag: how to do transaction Tag: 76242
Retricting database access.
For debugging purposes I have a class that takes in a
string and executes this supposed SQL string on a given
SQL Server Engine. For obvious reasons I would like to
lock down this class as tight as I can but I am finding
the access permissions a little daunting and I would like
to request some help.
First, I would like to restrict the command generated by
the SQL script to be read-only. I don't want it to modify
the data in the database at all. I don't see a read-only
mode for the database security.
Second, I would like to restrict the SQL servers that
this class can be run against. It seems like the
KeyRestrictionBehavior is doing what I want but I need an
example of how to use it with
SqlClientPermissionAttribute.
Any other tips would be much appreciated.
Kevin
rkevinburton@charter.net Tag: how to do transaction Tag: 76240
How do you manipulate records in an ADO.NET recordset?
This question seems oversimplified to me, but I come from the land of
creating recordsets in old ADO in which I could cycle through each
record in the recordset and assign the values of the record to
controls, count the number of records in the recordset, etc. In the
new ADO.NET, I can only seem to create a dataset which I can set to a
datagrid. The information in the datagrid is correct, but I want to
be able to cycle through the records, read the the information in the
dataset which I created by running a query against a table, and
manipulate(read or change) as I see fit. I will tackle saving the
information back to the database in the next phase. From my
experience, this seems like a really simple question. Can anyone
inform me of how simple or how complicated it really is?
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =--- Tag: how to do transaction Tag: 76239
@@IDENTIFIER and INSERT
Hi,
During an insert command, i'm using @@IDENTIFIER to
obtain the key (auto increment colonne).
4 users insert record in the same time.
result :
user1 : Key=1
user2 : Key=2
user3 : Key=2
user4 : Key=3
I've problem because the insert command is good but i've
only 3 new records ....
Could you help me please ? Tag: how to do transaction Tag: 76238
MissingMappingAction
I have been trying to figure out why when I set the MissingSchemaAction=
Error, I am getting an error. I have run out of ideas why this is
occurring. I know that I could choose the "passthrough" setting and all
would be well, but I want to understand why it is not happening - what
property am I not setting correctly?
I have enclosed everything about this situation as I can think of.
Here is the DDL for my small table (just a primary key, not foreign
keys)
CREATE TABLE [SkatingClubs] (
[ClubID] [uniqueidentifier] NOT NULL CONSTRAINT
[DF_SkatingClub_ClubID] DEFAULT (newid()),
[ClubName] [char] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT
NULL ,
CONSTRAINT [PK_SkatingClubs] PRIMARY KEY CLUSTERED
(
[ClubID]
) ON [PRIMARY]
) ON [PRIMARY]
GO
Here is how I set the table up in code...
DataTable dtClubs = new DataTable("SkatingClubs");
dtClubs.Columns.Add("ClubID",typeof(Guid));
dtClubs.Columns["ClubID"].AllowDBNull=false;
dtClubs.Columns["ClubID"].Unique=true;
dtClubs.Columns.Add("ClubName", typeof(string));
dtClubs.Columns["ClubName"].AllowDBNull=false;
dtClubs.Columns["ClubName"].MaxLength=50;
dtClubs.Columns["ClubName"].Unique=false;
// set up primary key for Clubs Table
DataColumn[] pkClubs = { dtClubs.Columns["ClubID"] };
dtClubs.PrimaryKey=pkClubs;
ds.Tables.Add(dtClubs); // add to the dataset
da.MissingMappingAction=MissingMappingAction.Error ;
da.MissingSchemaAction=MissingSchemaAction.Error ;
daFill(dtClubs);
Here is the Proc that I am executing (a little stripped down...)
select ClubID, ClubName
from dbo.SkatingClubs
set @recCount = @@ROWCOUNT
I get the following error "Missing Table Mapping when
TableMapping.DatasetTable='SkatingClubs'"
Any ideas as to what the "MissingMapping" might be? Tag: how to do transaction Tag: 76237
Safe to use regular ado in asp.net application
I am working in a large asp.net application. I have
found the ado.net learning curve to be quite large.
I have two big pieces left in this project. Would I be
safe using regular ado (not ado.net) in this? Tag: how to do transaction Tag: 76236
SQLCommand Parameters Error
Hello
I've just read in Visual Studio Magazine Nov 2003 that
using parameters in a sqlcommand is 37% faster than 'Exec
procedure_name param1,param2,etc'. So i was trying to use
it.
<code>
Me.SqlCommand2.Connection = Me.SqlConnection1
Me.SqlCommand2.CommandType = CommandType.StoredProcedure
Me.SqlCommand2.CommandText = "imprime_linha_mapa"
With Me.SqlCommand2.Parameters
.Add("@worker", SqlDbType.Char).Value = "-1"
.Add("@posto", SqlDbType.Decimal).Value = 0
.Add("@obra", SqlDbType.Char).Value = ""
.Add("@inicio", SqlDbType.Char).Value = ""
.Add("@fim", SqlDbType.Char).Value = ""
.Add("@deltah", SqlDbType.Char).Value = ""
.Add("@delta", SqlDbType.Decimal).Value = 0
.Add("@mov", SqlDbType.Decimal).Value = mov
End With
'Me.SqlCommand2.CommandText = "exec imprime_linha_mapa '-
1',0,'','','','',0," & mov.ToString
Try
Me.SqlCommand2.ExecuteNonQuery()
Catch ex As Exception
MessageBox.Show(ex.Message)
Me.SqlConnection1.Close()
Exit Sub
End Try
</code>
I get the following exception : Procedure or function
imprime_linha_mapa has too many arguments specified.
But that doesn't make any sense since the stored
procedure 'imprime_linha_mapa' has the following
declaration:
<code>
ALTER PROCEDURE imprime_linha_mapa
@worker char(255),
@posto numeric(3,0),
@obra char(8),
@inicio char(20),
@fim char(20),
@deltah char(8),
@delta numeric(6,2),
@mov numeric(9,0)
AS
</code>
What am i doing wrong? Any suggestion would be most
welcome, thanks!
Kind Regards
Jorge Cavalheiro Tag: how to do transaction Tag: 76231
hiye, is there a nice sql script example out there which
shows how t-sql transaction is done?
http://www.knowdotnet.com/articles/transactions.html
"smen" <anonymous@discussions.microsoft.com> wrote in message
news:05e901c3d4d7$f1daa080$a601280a@phx.gbl...
> hiye, is there a nice sql script example out there which
> shows how t-sql transaction is done?