|
hi iam work in project and we use disconnected db in our project
what is the scenario?
1- we create adapter that contain 4 stored procedures (insert_update_delete_insert)
2-we generate dataset
4-the adapter create sqlconnection
4- in the add button (that we use to add new product to our database i write the code down but it dosn't work no new rows are add to database )
i need to know where the wrong
****************the code******************************************
Try
SqlInsertCommand1.Parameters("@category_name").Value = TextBox2.Text
SqlInsertCommand1.Parameters("@category_description").Value = TextBox3.Text
DataSet21.AcceptChanges()
SqlDataAdapter1.Update(DataSet21, "categories_dir_sp")
Catch ex As Exception
MsgBox(ex.Message)
End Try
***********************************************************************
no rows are add to database what is the wrong in my code
ma_refay
|
|
|
|
|
Hi,
I would like to know what is the advantage of using Sql types in C# like SqlString, SqlInt32,etc... versus the normal type string, int etc...
The scenario: Having a class representing each table of the database. Each class has Insert, Update, Select, Delete methods (plus possible others) to perform those operations on the specific table represented by the class. Will there be a significant improvement of performance if my class variables are SQL types or not really?
Thanks for the insight.
Talal
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
--Rich Cook
|
|
|
|
|
Depending on how you use those classes, it could even hurt performance. Type conversion is going to occur every time you need to display or update a class instance variable that is SqlString, for example. On the other hand the conversion would normally only happen once per database read or write if the variables were normal String types.
Also, it's normally better to model your classes after business objects, rather than the database structures, that makes it easier to co-ordinate multi-table updates.
|
|
|
|
|
Thank you for the advice. You're right, I do perform a lot of type conversion everytime I want to display or update data from the database. I guess I will revert back to normal types
Talal
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
--Rich Cook
|
|
|
|
|
Hi!
Don't forget that there is another big difference between Sqlxxx types and the normal types: Sqlxxx types can be null (Property Null ). If your fields support null-values you should use Sqlxxx types.
Regards,
Rainer.
Rainer Stropek
Visit my blog at http://www.cubido.at/rainers
|
|
|
|
|
Hi,
Yes exactly, I do have some fields that are allowed to be null, in fact I decided to use Sqlxxx types because of that null thing, but I guess I can get around this by putting empty strings for string values and some special integer value (like -1) for int values.
Thanks for pointing this out.
Talal
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."
--Rich Cook
|
|
|
|
|
Hi,
What are counters in SQL Server. And its significance?
bsk
|
|
|
|
|
Counts allow you monitor the performance of SQL server and tune your server and schema for better performance.
Look where you want to go not where you don't want to crash.
Bikers Bible
|
|
|
|
|
What is the significance of Counters in Replication (SQL Server)?
bsk
|
|
|
|
|
Hi Kumar,
SQL Server has about 150 different counters which can be enabled to measure system (database) performance. You can get lots of information regarding performancing monitoring and tuning including using counters at : www.sql-server-performance.com for example.
You set counters to measure things like page faults per second or user connections etc etc
Cheers,
Kevin
|
|
|
|
|
INSERT titles (title, cost)
VALUES ('testing', '35')
why SQL statement above can work? since the 35 is interger and not a string, so shount not be include '' for interger value....
angela
|
|
|
|
|
Sure it works
u can add values as integer too (for integer filed)
ur example works as this:
INSERT titles (title, cost)<br />
VALUES ('testing', 35)<br />
|
|
|
|
|
i know, because i test before..
but i don't know why i can work....
angela
|
|
|
|
|
Automatic data type conversion.
----------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
oic, no wonder it works lah;)
thanks ya..
angela
|
|
|
|
|
how to change SQL statement below to use CASE instant of "AND" "OR" after condition where :-
ALTER PROCEDURE dbo.authorInfor
@au_lname varchar(40)
AS
select title, price, Name = substring (au_lname, 1,40), type
from authors a, titles t, titleauthor ta
where a.au_id = ta.au_id AND t.title_id = ta.title_id AND(au_lname = @au_lname OR au_lname = '' OR au_lname is Null)
Thanks.
Angela
|
|
|
|
|
If AND OR works use it; its must more efficient than using case.
Look where you want to go not where you don't want to crash.
Bikers Bible
|
|
|
|
|
really can works and get the result that what i want with my previous SQL statement...
the matter is my boss want me to change the predicate to use "Case"
anyway thanks for your suggestion;)
angela
|
|
|
|
|
CASE is generally used in instances where you want a different field value returned based on specified conditions. Your select statement is only concerned with returning all fields based on certain conditions. In other words, CASE wouldn't be used in the WHERE clause of an sql statement such as yours.
You could clean this up a little though, like this:
select title, price, Name = substring (au_lname, 1,40), type<br />
from authors a inner join titleauthor ta on a.au_id = ta.au_id inner join titles t on ta.title_id = t.title_id<br />
where au_lname = @au_lname OR isnull(au_lname,'') = ''
Or your where clause could be like this:
where isnull(au_lname,'') IN (@au_lname,'')
Other than that, nothing comes to my mind.
----------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
no wonder i can't get what i want if i change the predicate to use "CASE" in my SQL statement
can see that your SQL statement is more simplify and better than mine
but 1 of my condition is when user do not insert any value for author's name, all author's name record will display in my result..
if using your SQL statement above, if i insert null for my author's name, then the result is empty..
|
|
|
|
|
I get a SQL statement that can use CASE under my condition
Declare @au_lname char(30)<br />
<br />
Select @au_lname = ''<br />
<br />
select title, price, <br />
Name = substring (au_lname, 1,40), type<br />
from titleauthor ta JOIN authors a on ta.au_id = a.au_id<br />
JOIN titles t on ta.title_id = t.title_id<br />
<br />
Where 1 = <br />
Case<br />
When RTRIM(@au_lname) = '' Then 1<br />
When RTRIM(@au_lname) <> '' And <br />
RTRIM(UPPER(@au_lname)) = RTRIM(UPPER(au_lname)) Then 1<br />
Else 0<br />
End
it's cool
angela
|
|
|
|
|
I see. Thank you for posting your solution.
----------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters
|
|
|
|
|
Dear Sir
I created New Package by wizard in SQL server 2000. I want to write store procedure to execute it but i don't know how to write it.
could you tell me how to write it?
|
|
|
|
|
SaravuthYos wrote: SQL server 2000. I want to write store procedure
See the documentation: CREATE PROCEDURE[^] and EXECUTE[^]
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
Stored Procedure
===================
create procedure dbo.myProcAS
selet * from customers
go
=====================
running this
exec myProc
Parameter Stored Procedure
=============================
create procedure dbo.MyProc
@CustNumber int
AS
SELECT * from customer
WHERE CustomerID = @CustNumber
go
=============================
running this
exec myProc 1001
Look where you want to go not where you don't want to crash.
Bikers Bible
|
|
|
|