|
ok, i already know how, I saw the process and the codes in the internet...i used the "DISTINCT" in the query builder in Data Configuration Wizard... Then i put this codes in the search button:
OleDbDataAdapter2.SelectCommand.Parameters("subject").Value = ComboBox1.Text<br />
DataSet21.Clear()<br />
OleDbDataAdapter2.Fill(DataSet21)
but how, if i will going to put the codes in the combobox? Because what i want is if i will going to select a subject in the combobox, the students who enroll in that subject will automatically displayed in the datagrid without clicking the search button... Where i will going to put the codes above?
-- modified at 2:31 Sunday 15th July, 2007
|
|
|
|
|
First of all, do yourself a favor and dump the DataGrid and use the DataGridView. You will be much happier with the added flexibility it has. Either way you can reset the contents by changing the DataSource, preferably to a DataView object.
Tom Garth
Developer
R. L. Nelson and Associates, Inc., Virginia
|
|
|
|
|
I created a db in as a dummy in sql 2005 and set the recover as full.But I want to know when there is a problem with the db how to recover.
I have backed up it also.
|
|
|
|
|
|
Hi ALL
In my application i wrote a query like this
"select * from Cand_Information where Category= '" & DpCat.SelectedItem.Text & "' or (First_Name= '" & TxtFname.Text & "' or Last_Name= '" & TxtLname.Text & "' or Sex= '" & DpdownSex.SelectedItem.Text & "' )"
But i want the Category field to be mandatory so i kept it outside the bracket. so that it should only display data with that particular Category. so rest of the fields are optional.
How to write the correct one pl help
Regards
Prakash Mishra(Banglore,India)
|
|
|
|
|
Change the or to an and
"select * from Cand_Information where Category= '" & DpCat.SelectedItem.Text & "' and (First_Name= '" & TxtFname.Text & "' or Last_Name= '" & TxtLname.Text & "' or Sex= '" & DpdownSex.SelectedItem.Text & "' )"
Ben
|
|
|
|
|
HI
i tried it before also but according to specification if i select only Category then also records should be displayed. if i put and there then i need to select at least one field from the or options. else it not show any record.
Regards
Prakash Mishra(Banglore,India)
|
|
|
|
|
Try this:
<code>string optionalFiters="";
if(TxtFname.Text!="")
optionalFiters+=" and First_Name= '" & TxtFname.Text + "'";
if(TxtLname.Text!="")
optionalFiters+=" and Last_Name= '" & TxtLname.Text + "'";
if(DpdownSex.SelectedItem.Text!="")
optionalFiters+=" and Sex= '" & DpdownSex.SelectedItem.Text + "'";
</code>
Query:
<code>"select * from Cand_Information where Category= '" & DpCat.SelectedItem.Text & "'" & optionalFiters
</code>
Regards,
Arun Kumar.A
|
|
|
|
|
Please tell me how to insert a string like this: SAMPLE'STRING into an SQL table? How escape special characters in MSSQL?
Thank you.
--------------------------------
visit: http://pmartike.deviantart.com/
|
|
|
|
|
Problem solved
--------------------------------
visit: http://pmartike.deviantart.com/
|
|
|
|
|
I have a Classic ASP website and i want to use MS SQL Express edition as the datasource. I tried the .NET Connectionstring and they do not work for the Classic ASP (ADO) site. I have tried figuring this out for the last three days. PLEASE HELP! Thanks in advance.
|
|
|
|
|
What kind of messages are you getting, if any?
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
Here is the connection string im using:
Data Source=.\SQLEXPRESS; Integrated Security=True;AttachDbFilename=|DataDirectory|\MyDatabase.mdf;Initial Catalog=MyDatabase
This is the error:
Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.
|
|
|
|
|
|
Okay I changed my ConnectionString to:
Provider=SQLNCLI;Server=localhost\SQLExpress;Database=data.mdf;
I now get a new Error:
Invalid authorization specification.
I do not have a username or password on the file. Now what??
|
|
|
|
|
It should be:
Provider=SQLNCLI;Server=.\SQLExpress;AttachDbFilename=FullyQualifiedPathToDBFile.mdf;Database=dbname;Trusted_Connection=Yes;"
This will only work for code executed server-side. It won't work for client-side code.
|
|
|
|
|
This CS did the trick. Thanks
|
|
|
|
|
please read the forum guidelines.
_____________________________________________
Flea Market! It's just like...it's just like...A MINI-MALL!
|
|
|
|
|
Dang. You beat me to it. Just saw the cross post in the other forum and wondered where I saw it before.
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
leckey wrote: Flea Market! It's just like...it's just like...A MINI-MALL!
What happened to cats and awesome.
Regards,
Satips.
Don't walk in front of me, I may not follow;
Don't walk behind me, I may not lead;
Walk beside me, and just be my friend. - Albert Camus
|
|
|
|
|
Hi,
How can i create hash clustered index in oracle?
Best Regards,
Mushq
Mushtaque Ahmed Nizamani
Software Engineer
Ultimus Pakistan
"English is my second language, so please don't mind if i do some grammatical or spelling mistakes in my messages."
|
|
|
|
|
Have you looked around in the Oracle forums?
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
hi friends
this is my stored procedure:
CREATE procedure dbo.sp_ins_logo
@companyname varchar(120),
@country varchar(80),
@url varchar(150),
@category varchar(80),
@description varchar(250),
@picturepath varchar(80),
@picturetype char(5),
@status int,
@ins_status varchar(10) output,
@lcode varchar(10) output
as
set nocount on
begin transaction
declare @logo_rowid decimal
declare @logo_code varchar(10)
declare @logo_rowcount decimal
declare @max_logoid decimal
declare @logo_codepfix char(3)
set @logo_codepfix='LGO'
select @logo_rowcount= (select count(*) from dbo.tbladdlogos1)
if @logo_rowcount = 0
begin
select @logo_rowid = 1
select @logo_code = @logo_codepfix + convert(varchar(5),@logo_rowid)
end
else
begin
select @max_logoid = (select max(row_id) from dbo.tbladdlogos1)
set @logo_rowid = @max_logoid + 1
set @logo_code = @logo_codepfix + convert(varchar(5),@logo_rowid)
end
declare @file_name varchar(80)
set @file_name = @picturepath + @logo_code + '.' + @picturetype
if not exists (select companyname from dbo.tbladdlogos1 where url = @url)
begin
if not exists (select companyname from dbo.tbladdlogos1 where companyname = @companyname)
begin
insert into dbo.tbladdlogos1 values(@logo_rowid,@logo_code,@companyname,@country,@url,@category,@description,@file_name,@status)
declare @ER as int
select @ER = @@error
if @ER <> 0
begin
set @ins_status='Failure'
set @lcode=@logo_code
end
else
begin
set @ins_status='Success'
set @lcode=@logo_code
end
end
end
commit
GO
this is my table
CREATE TABLE [tbladdlogos1] (
[row_id] [int] NOT NULL ,
[logo_code] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[companyname ] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[country] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[url] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[category] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[description] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[picturepath] [varchar] (300) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[status] [int] NULL
) ON [PRIMARY]
GO
i inserted value
below error is occured
Invalid object name 'dbo.tbladdlogos1'. Transaction count after EXECUTE indicates that a COMMIT or ROLLBACK TRANSACTION statement is missing. Previous count = 0, current count = 1.
can u help me
regards
saravanan
|
|
|
|
|
First, check that you're executing the above in the right database, or that you created the table in the right database. We've all done it.
Second, you've used BEGIN TRANSACTION in the above code, but you didn't tell SQL Server what you wanted to happen at the end. You should use COMMIT TRANSACTION to save the changes you've made, or ROLLBACK TRANSACTION to discard them. Generally you should check @@ERROR after every data modification statement and ROLLBACK TRANSACTION (and return) if it's not 0. Only critical errors abort the stored procedure and automatically rollback the transaction. Errors like attempting to insert a duplicate key are not considered critical; the statement will be aborted and rolled back, but execution will continue at the next statement.
SQL Server does not permit transactions opened in a stored procedure to be held open after that procedure executes. That's why you get the error. If you want a transaction to span multiple procedure calls, you'll have to use a client-side transaction (e.g. a SqlTransaction object).
|
|
|
|
|
...and in addition to that, make sure you have granted access to the user that you are when executing the call.
Tom Garth
Developer
R. L. Nelson and Associates, Inc., Virginia
|
|
|
|