|
hi,
what is the differance between connected and unconnected layer?
I read a book that tried to explain that but
I saw in the examples that in both layers
the commands are the same and you can retrieve data insert data
and so on.
so what is the differance?
|
|
|
|
|
A connected system will keep the connection to the database open. Disconnected means that the data is read in to memory, and the connection is closed - if the data changes, a connection to the database is obtained to persist the change and the connection is closed again.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
I have written a data access layer running under com+
Using the IBM Informix ODBC driver, I am able to select from a table with no problems, when I attempt to updtate the table, the error I receive is "Invalid string or buffer length" (all my googling seems to indicate that this message may have something to do with parameters)
I have set up a test application that performs identical operations to the com+ app. These are:
. Open Connection
. Create a select command
. Fill dataset adapter using select command and adapter
. Alter 1 single field in a single row
. Create an update command
. Call adapter.update
Now here's the weird thing.
The test app works fine, the com+ app fails. When I compare the SQLTrace between the 2 applications. The test application which works, generates many, many more ODBC instructions than the failing com+ app.
Each application is performing the identical workload through the same driver using the same the system.data.odbc objects.
Does anybody have any ideas? I've been banging my head against this for a while now and have no idea what to try next.
Much thanks.
-- modified at 3:35 Wednesday 10th January, 2007
|
|
|
|
|
The bug was caused by me having only one pair of eyes.
Adding another 2 eyes to the code revealed...
That If you use the ODBCParameter object, and the sourceColumn property contains a leading space...
Things don't work.
|
|
|
|
|
Hi,
I want to prevent the admin from being able to store 2 user records which both have the same username.
So far, I have pupulated a Dataset variable with the details, but I am unable to work it into an IF statement. Any suggestions??
Thank you
|
|
|
|
|
Have you tried ?:
string sql = @'
IF NOT EXISTS(SELECT * FROM foo WHERE user = @username) BEGIN
INSERT INTO foo (user) VALUES (@username)
SET @Success = 1
END ELSE BEGIN
SET @Success = 0
END';
bool bSuccess = false;
using(SqlConnection conn = new SqlConnection("connection string")){
SqlCommand cmd = new SqlCommand(conn, sql);
cmd.Parameters.Add("@username", SqlDbType.Varchar, 50);
cmd.Parameters.Add("@Success", SqlDbType.Bit);
cmd.Parameters["@username"].Value = DataSet.Tables[0].Rows[0]["Username"];
cmd.Parameters["@Success"].Direction = ParameterDirection.InputOutput;
conn.Open();
cmd.ExecuteNonQuery();
bSuccess = (bool) cmd.Parameters["@Success"].Value;
}
if(!bSucess)
{
//tell the user
}
|
|
|
|
|
Dear All,
I am bit new to this programmming world. Currently i am making web application using C# ,asp.net and sql. in a web page there i have listbox with multiple selection option. now with single option i am able to save the form data. but problem occur when there is multiple option. as i am confuge with how can i based on selection (no of selected data). i can save the record. please guide me.
thanks
regards
imran khan
|
|
|
|
|
I don't understand what you are trying to insert into the datbase. You have not said which database you are using (SQL is a languge that is used by pretty much all relational databases - Did you mean SQL Server?)
If you can give the code you currently have it might also help because there are many ways to put data in the database.
|
|
|
|
|
thanks for quick responce,
Actually there is agent master where i need to capture or display agent name,
Services he provides(listbox with multiple select option) and which branch he belongs to corresponding to agentid. Fine . Now One agent can provides any no. of services. so i have provides listbox with multiple select option. i need to save all this information.
my problem is how based on no. of selected listbox data. how can i save the all record. rightnow i saparated this infomation to two table. in one table
i am saving agentid, agentname, branchid, in other table i am saving service no of service. but i am confuged... in
1> how can i retrieve listbox data on save button.especially when there is nultiple records.
2> how can i display it back on edit command and save the changes.
i am using sql2000 along with asp.net and C#
please guide me
thanks
regards
imran khan
|
|
|
|
|
Hai,
Here are the Steps.
1)declare a string strListOptions="";
2)Now Iterate through the ListBoxItems
foreach(ListItem li in lbServices.Items)
{
if(li.Selected)
{
if(strListOptions.length>0)
{
strListOptions+=","+li.Index.ToString();
}
else
{
strListOptions+=li.Index.ToString();
}
}
}
3)Save the Agent Data and Return the AgentID.
4)Save the Services Altogether or individually in the Services Table with the AgentID.
While Retriving:
1)Loop through the records and loop through the list items and select the corresponding indexed listItem.
If you have any problem let me know.
You need to modify the same according to your conditions.
|
|
|
|
|
Hi, somebody know a .Net component able to describe a database using a graph or other browsable data structure thanks to ADO.net ?
I founded Component One DataObjects click here
Thanks !!!
-- modified at 6:22 Monday 8th January, 2007
|
|
|
|
|
Hi every one,
well I'm installing the SQL Server 2005 workgrp edition right now and I had its cd's image u know. well I have run the setup now and there is no sign of "SQL server management studio" in the menu. I selected all the components during the installation and when it scanned the system it showed me a warning that the system requirements are not fulfilled... I must tel u that I'm not upgrading from sql server 2000, its a completely new installation.
how do we know if its a 64 bit version or a 32 bit version.
and plz tell me where am I goin wrong here... is it something I'm missing or what?
well actually I never wanted to use sql 2005 at the first place, I was goin for sql 2000 workgrp ed. but it was not available any where here.
thanks in advance
Rocky
|
|
|
|
|
Can somebody tel me how to create user interface for query builder for select,insert,update,delete statement in asp.net using c#.net
abhijeet
|
|
|
|
|
|
I have a msde server bound to an application.
The application's purpose was to work into a lan, and all went well.
A special user (login) was created for the application use, gratend access to the appication databases, etc.
The problem occured when the database was made public (the computer was connected to the internet and the clients wore not from the lan).
I recive an error message about the inexistence of the server...
So I tried to conenct to the server by the "old way":
osql -S myserver.mydomain.ext -U myUser.
Doing this, the server prompts for a password, and wheater the password is good or wrong I recive the message about the inexistence of the server.
Can anybody help me?
protected internal static readonly ... and I wish the list could continue ...
|
|
|
|
|
How to insert the CheckBox Boolean Values into SQL database using 'SqlDbType.Bit' ...
vidya K.A
|
|
|
|
|
vidya.K.A wrote: How to insert the CheckBox Boolean Values into SQL database using 'SqlDbType.Bit' ...
The same way you'd put in any other Boolean value. However, your request is sufficiently vague to allow several possible correct answers. How do you want to do this? That might help someone fill in the gaps for you.
|
|
|
|
|
Assume spTest as the SQLParameter object and cmdTest as the SQLCommand object:
<br />
spTest = new SqlParameter();<br />
spTest.ParameterName = "@YourTableColumn";<br />
spTest.SqlDbType = SqlDbType.Bit;<br />
spTest.Value = yourCheckBox.Checked;<br />
cmdTest.Parameters.Add(spTest);<br />
cmdTest.ExecuteNonQuery();<br />
SkyWalker
|
|
|
|
|
Hi.
I would like to know how to compare data in different columns but in the same table.(e.g table has two columns one(A and B).I would like to know if i can check if a value in column B exists in column A.
Thanks
Felix
|
|
|
|
|
select b from table x<br />
where exists(select * from table y where x.b = y.a)<br />
Wout Louwers
|
|
|
|
|
Doesnt work.
may work for data in the same row,but for data in different rows this does not work.Thanks anyway
Feleacks
|
|
|
|
|
feleacks wrote: I would like to know how to compare data in different columns but in the same table.
There are two ways (in my knowledge) to do this: 1) Self joining the table. 2) using sub query with EXISTS keyword.
feleacks wrote: I would like to know if i can check if a value in column B exists in column A.
1)
select distinct x.a , y.b from xx x inner join xx y on x.a=y.b --self joining
2)
select b from xx where <code>exists</code> (select * from xx x1 where xx.b=x1.a) --sub query with exists keyword
Here the sub query does not produce any data set, rather it returns True or False . The outer where checks the existence of the rows returned by the sub query. There is a bit difference between the sub query with the exists keyword and other sub queries. Here is an extraction form SQL Server Books Online
>The keyword EXISTS is not preceded by a column name, constant, or other expression.
>The select list of a subquery introduced by EXISTS almost always consists of an asterisk (*). There is no reason to list column names because you are simply testing for the existence of rows that meet the conditions specified in the subquery.
Alternatively, you can also do it as follows:
select b from xx where b = ANY (select a from xx)
-- modified at 3:02 Tuesday 9th January, 2007
The above lines of code are tested with SQL Server 2000
Regards
________________________________
Success is not something to wait for, its something to work for.
|
|
|
|
|
Hi All,
plase can anyone tell me the new features(few) of SQL server compared to their versions?
Thanks,
Rahi
If you look at what you do not have in life, you don't have anything,
If you look at what you have in life, you have everything... "
|
|
|
|
|
I never heard of SQL server 2003.
The new features of Sql server 2005 are described here[^]
Wout Louwers
|
|
|
|
|
Rahithi wrote: SQL Server 2003
There is no such product. Were you thinking of Windows Server 2003?
|
|
|
|