|
|
Hi,
I have a table Main with 3 fields: ID, Name, and Info.
I created a listbox, but how do i populate it using with data from this query.... "select distinct Name from Main"
Below is the portion of my code.
***************
OleDbDataAdapter* da;
OleDbConnection* odc;
DataSet* ds;
odc = new OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=d:\\Main.mdb");
da = new OleDbDataAdapter("SELECT DISTINCT Name FROM Main",odc);
ds = new DataSet();
da->Fill(ds,"Main");
//stuck... don't know how to proceed from here.
please help..thanks!!!!
|
|
|
|
|
I am developing an sms messaging app (Let say app A) with backend in SQL2K. This app depends on a schema of an already deployed application (Let say app X). I have also created a schema of my own application which may reside on any other machine.
Whenever app X done a transaction on some of the tables I am initiating a trigger from there. After doing some operations on the inserted record in the trigger I am inserting that record to my own schema generated for App A by the link server to my Schema.
I have made a windows service, whenever a new rocord is inserted in my tables through schema I'll compose and send an SMS message to my client.
My problem is since triggers runs in an implicit transaction whenever the inserting triggers fails the transaction which was inserted by App X is also got failed. Which I don't want. How to cope with this... I don't know about error handling. How to implement fail save recovery in this scenario.
SMK
|
|
|
|
|
Hi All,
I want to know whether loops in ERDs are wrong or show weak design or not.
Example: if table A is connected to table B & table B is connected to C & C is connected to A..
Is this wrong??
Actually the ERD is larger than that & the alternative is to make multiple joins when retreiving data so I want to know which is better.
Thanks a lot
|
|
|
|
|
mytotaleclipse wrote: want to know whether loops in ERDs are wrong or show weak design or not
No, they are not wrong.
|
|
|
|
|
The tightest "loop" (relationship) you can have is when a table joins onto itself - which is perfectly valid.
e.g. An employee has a manager, a manager is an employee also. So the managerID column of the employee table refers to the ID of another employee.
|
|
|
|
|
Hi,
How to search all columns of a table in a database for a keyword?
I am using ASP.NET 2.0 and Sql Server 2000. Give me the logic behind this operation?
Thanks,
Regards,
Regards,
Jay
|
|
|
|
|
Not sure exactly what you are trying to do, but if you need to look for a particular value and if you are using datatables you could loop through your column names and in each loop run a datatable.select command, storing the values in an array.
More information would be helpful.
Our developers never release code. Rather, it tends to escape, pillaging the countryside all around.
The Enlightenment Project (paraphrased comment)
GISDevCafe.com
|
|
|
|
|
hi guys
can anyone plz tell me the syntax for the following queries
1.Alter Table name
2.Alter Column name
3.Alter Column dataType
4.Alter Primary/Foreign/Unique constraints of a Column
plz tell queries that work in Sql Server.
these are the queries that i am using for the first two tasks and they don't work
1.
string sql="ALTER TABLE "+comboBox2.Text+" TO "+new_tn;
2.
string sql="ALTER TABLE "+comboBox2.Text+" RENAME COLUMN "+new_tn;
regards
|
|
|
|
|
The syntax for SQL Server 2000 is:
1. EXEC sp_rename 'old_table_name', 'new_table_name'
2. EXEC sp_rename 'table_name.old_column_name', 'new_column_name', 'COLUMN'
3. ALTER TABLE table_name ALTER COLUMN column_name new_data_type
4. Lookup "ALTER TABLE" in "SQL Server Books Online".
Regards
Andy
|
|
|
|
|
thank you
regards
Saira
|
|
|
|
|
I want examples of some complex sql queries.
such as there could be some 2 - 3 tables as Purchase , Order and Order Details etc..
and there would be some 50 questions asked with answers i.e sql queries
pls suggested me some links that would contains above mentioned example.
Thanks in advance
Praveen
|
|
|
|
|
If you have Access of SQL Server 97/2000 installed, I would suggest that you take a look at the stored procedures/queries that are installed as part of the reference database. If you have some variant of SQL Server 2005, the AdventureWorks database is an excellent source of queries to look at.
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.
|
|
|
|
|
Hi, I am learning C# and .NET 2.0. I have so far read two books that touch on ADO and SQL. They are Pro C# 2005 and the .NET 2.0 Platform and Pro .NET 2.0 Windows Forms and Custom Controls in C#. They both confused me more than anything. I want to understand these concepts as a Windows or ASP .NET application programmer. I want to understand how to access databases as well as create one, but don't want to learn enough to become a DBA. I just want to know enough to know what I am doing with them.
For example, I am thinking of writing a client/server Quicken like program. Users can access it to create their own bank accounts, and others can then access the DB to get reports.
So where should I start? Do I get a book on SQL or ADO .NET first? Is there a good book that explains it to a beginner?
Thanks!
|
|
|
|
|
|
Will SQL Server truncate input that is longer than the allotted field automatically or do I need to pre-truncate it? I only ask because some code I've inherited does this and I always thought that it would just drop what didnt fit.
I also know this isnt a good thing necessarily and may never be an issue but it just seems like wasted comp cycles to do this in the application.
Cleako
|
|
|
|
|
I have always been of the opinion that the data should be as clean as possible before it gets sent to the database. As a user, I would prefer to know if my data is being truncated and have the ability to change it if it is. Sometimes a re-wording is preferrable to a truncation.
|
|
|
|
|
The problem in my case is that I am working on a web service so it is up to the sending person to limit the length.
Are you saying, though, that you would rather have the data pre-truncated than to let SQL Server do it?
Cleako
|
|
|
|
|
|
Hi,
I am using fulltext indexing for searching for a list of values in a given text field(which contains description).
For example this is my query.
select * from details where contains(description,'"manager" or "sales manager" or "zonal manager"')
Now I have the second part of the contians in another table. i.e '"manager" or "sales manager" or "zonal manager"' is stored in another table.
But when I am giving select statement in the second part of contains it is giving me an error. How to search for description by taking values from another table with out using loops and in a single query.
If I am using cursors and performing the search it is taking lot of time.How can I speed up?
Regards,
Uma
|
|
|
|
|
I'm not sure i entirely understand your question, but can you not join onto the other table in the query?
|
|
|
|
|
how can we put variable inside the query i put it as
'select '+@name+' =hlp_tTblNm from mhelp with(nolock) where hlp_tAlias='acc2''
but it shows problem
shailendra
|
|
|
|
|
No, this won't work because the result of your varible gets placed inside the query and not the variable reference. If you are going to use a variable inside a dynamic t-sql string that variable must be declared inside the actual t-sql string.
Plus, if you're using your select statement to instantiate the variable @name is probably null. Which means if CONCAT_NULL_YIELDS_NULL is set to the default your entire string will be null.
If you can provide context for what it is you're trying to do we can give a recommendation that will help. Right now there are too many possibilites.
But I will at least take an initial jab and say that you're trying to do something like this:
<br />
DECLARE @Sql VARCHAR(2000)<br />
<br />
SET @Sql = '<br />
DECLARE @name = VARCHAR(50)<br />
SELECT @name = hlp_tTblNm FROM mhelp WITH(NOLOCK) WHERE hlp_tAlias = 'acc2'<br />
<br />
SELECT .... FROM ??? WHERE ??? = @name'<br />
<br />
EXECUTE (@Sql)<br />
|
|
|
|
|
I have to take the value of a column in a variable @name
The below code works fine but i have to take it in another variable @query
but it doesn't works please suggest me the solution
declare @name varchar(50)
declare @query varchar(500)
select @name=hlp_tTblNm from mhelp with(nolock) where hlp_tAlias='acc2'
print @name
problem
*********
declare @name varchar(50)
declare @query varchar(500)
set @query='select '+@name+'=hlp_tTblNm from mhelp with(nolock) where hlp_tAlias='acc2''
print @name
print @query
this code give me error incorrect syntex near acc2
shailendra
|
|
|
|
|
You need to put two quotes in before acc2, e.g. ''acc2''.
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.
|
|
|
|