|
It does not work or how i can do something like this ?
Discover Other ....
http://www.islamHouse.com
|
|
|
|
|
There ways that you can do that, if i understand you Correctly , you want to Bind the Results from the DB to the indivisual Textbox. You can Create a Class that has a Function to get you Data , or you can create your Function in your Form (thats not professional) and call your Function like this
public class Class1
{
public DataTable GetData()
{
int Code;
String strCon = "blablablablablablabla";
SqlConnection con = new SqlConnection(strCon);
SqlCommand cmdselect = new SqlCommand();
cmdselect.CommandType = CommandType.StoredProcedure;
cmdselect.CommandText = "student_SelectAll";
cmdselect.Connection = con;
DataTable DT = new DataTable();
try
{
con.Open();
DT = cmdselect.ExecuteNonQuery();
}
catch(SqlException)
{
throw;
}
finally
{
con.Close();
}
return DT;
}
}
This is a Class that has a Function Getdata that returns a Datatable and in your Form you access the Function and Bind the Textbox like this
Class1 obj = new Class1();
DataTable DT = new DataTable();
DT = obj.GetData();
txtname.Text = DT.Columns[0];
txtlastname.Text = DT.Columns[1];
Am Sorry for the untidy code, am just in a Hurry for a meeting.
Hope this Helps
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
hello everyone..
i have a problem regarding in using sursor in oracle 10i.
how can i pass to a cursor the output from stored procedure?
like this one:
CURSOR cur1 IS
SAMPLESP(); --sample stored procedure.
but when itry this i get this error: PLS-00103: Encountered the symbol "SAMPLESP()" when expecting one of the following:
( select
please help..
thanks in advance.
jyn
modified on Tuesday, November 18, 2008 6:33 AM
|
|
|
|
|
cursors are passed as inputs to stored procedures in oracle and the stored procedure then assigns them.
Need software developed? Offering C# development all over the United States, ERL GLOBAL, Inc is the only call you will have to make.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
Most of this sig is for Google, not ego.
|
|
|
|
|
To add to the previous post, the technological term for this is REF CURSOR . For more information, see
PL/SQL User's Guide and Reference
Chapter 6 Performing SQL Operations from PL/SQL
Using Cursor Variables (REF CURSORs)
Mika
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
Hi friends
Would u please help me to install SQL Express 2005 in silent mode....with necessary parameters ?
With warm regards
Dyno
|
|
|
|
|
|
Hi all i hav a query for which i got the result but i am not able to understand the query....
here's the query...
select sal,to_char((to_date(sal,'j')),'jsp') from emp;
Result: 3250 Three Thousand Two Hundred and Fifty.
I just need the explanation of to_date and to_char command formats.....
if possible can any one giv one example each on those two commands..
Thanks in Advance...
Byee
|
|
|
|
|
TO_CHAR and TO_DATE are built-in functions in Oracle.
TO_CHAR = Convert number to string
TO_DATE = Convert string to date
|
|
|
|
|
i got ur point but how the given value is getting converted into words....
|
|
|
|
|
|
Hi, I'm new to SSIS and am trying to create a project that uses a Flat File as the source file and extract data from a column (containing ReportDate) and use this parameter to set the Where clause in a stored proc to delete records from a SQL Server table. I'm sure this can be done, just don't know how.
Thanks in advance for any help you might provide.
|
|
|
|
|
Delete From TableName Where CoulmnName = @Parameter
|
|
|
|
|
Hi,
I have a stored proc which retrieves a value from my database. If I select the value I then want to do a case statement and return a string. This is my code but I can't get it to work:
create procedure procGetEventType
(@EventID int, @EventHeading varchar(12))
as
declare@desc varchar(50)
select @desc = 'Unknown event type'
begin
select [EventID], [EventHeading]
from tblEvents
where [EventID] = @EventID
if ([EventHeading] = 'Info') desc = 'Information'
if ([EventHeading] = 'Warn') desc = 'Warning'
if ([EventHeading] = 'Error') desc = 'Error'
return @desc
end
I can't even create the stored procedure because I get a syntax error. It complains about EventHeading being an invalid column heading and when I comment out the "if" lines it's OK. If I have done a select on a column can I not then refer to it later on?
Any ideas?
|
|
|
|
|
Few issues:
- define variables where you place the result from SELECT
- don't use parenthesis on parameters if creating a procedure but do use them if creating a function
- procedure cannot return a value, use output parameter or create a function.
Most likely you want to use a function for the logic you described. In that case it would be something like:
create function GetEventType (@EventID int)
returns varchar(12)
AS
declare @desc varchar(50)
declare @eventHeading varchar(12)
begin
select @eventHeading = [EventHeading]
from tblEvents
where [EventID] = @EventID
--
set @desc = 'Unknown event type'
if (@eventHeading = 'Info') set @desc = 'Information'
if (@eventHeading = 'Warn') set @desc = 'Warning'
if (@eventHeading = 'Error') set @desc = 'Error'
---
return (@desc)
end
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
Thanks for such a carefully created answer - that's solved my problem perfectly and more importantly, helped me understand the issue I had.
Thanks again
|
|
|
|
|
You're welcome
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
Hi,
I'm stuck getting info from all files in een directory using the filesystemobject.
Can someone help me out ?
here's my code so far :
DECLARE @fileobj INT , @fsobj INT
DECLARE @folderobj INT
DECLARE @exists INT, @error INT
DECLARE @Property varchar(255)
DECLARE @src VARCHAR(255), @desc VARCHAR(255)
EXEC master.dbo.sp_configure 'show advanced options', 1
RECONFIGURE
EXEC master.dbo.sp_configure 'Ole Automation Procedures', 1
RECONFIGURE
EXEC @error = sp_OACreate 'Scripting.FileSystemObject', @fsobj OUT
EXEC sp_OAGetErrorInfo @fsobj, @src OUT, @desc OUT
SELECT CONVERT(varbinary(4),@error), Source=@src, Description=@desc
-- EXEC sp_OAGetProperty @folderobj, 'Name', @Property OUT
-- print @Property
EXEC sp_OAMethod @fsobj, 'GetFolder', @folderobj OUT,'C:\'
EXEC sp_OAGetErrorInfo @folderobj, @src OUT, @desc OUT
SELECT CONVERT(varbinary(4),@error), Source=@src, Description=@desc
/* RETURN NOTHING */
--EXEC sp_OAGetProperty @folderobj, 'Name', @Property OUT
--print @Property
/* CREATE A TEMP TABLE */
IF OBJECT_ID('tempdb..#dirlist') IS NOT NULL
DROP TABLE #DirList
CREATE TABLE #dirlist (FName VARCHAR(1000))
/* FILL TEMP TABLE WITH FILES COLLECTION */
INSERT INTO #dirlist (FName)
EXEC sp_OAGetProperty @folderobj , 'Files', @fileobj OUTPUT
EXEC sp_OAGetErrorInfo @fileobj, @src OUT, @desc OUT
SELECT error=CONVERT(varbinary(4),@error), Source=@src, Description=@desc
/* SHOW FILES */
select * from #dirlist
Question is how can i fill my temp table? (it's still empty)
Thx,
Kurt
|
|
|
|
|
Hi All,,
I want to get a Max value from a table and increment it by 1,, such as
if the max value is 1/50, It will be 2/50, but the problem how to get it from a db.
thanks all,,
|
|
|
|
|
I'm not sure if I understood you correctly, but querying the maximum value for a column would be something like:
SELECT MAX(ColumnName) FROM TableName
Is that what you're looking for?
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
i din get ur problem in right way but i hope my answer will benefit u in some way.....
ex. if u hav a salary column in emp table and suppose if u want to select the maximum sal from table and increment it by 3000 rs. then try the following procedure for this...
create or replace procedure sal_increment as
v_maxsal number(20);
begin
select max(salary) into v_maxsal from emp;
update emp set salary=salary+3000 where salary=v_maxsal;
end;
Hope u understood the problem and the solution given above....
and i hope u had query in pl/sql.....
|
|
|
|
|
Hi all,
I made one procedure in which i use sp_cursoropen procedure and it has one parameter for rowcount. When i execute the procedure, it does not return rowcount, i mean it returns -1 even there is 20 records in my table.
Can anybody help me...
Thanks
Krishnraj
|
|
|
|
|
Hi
Put return at the end of you're stored procedure
declare @counter int
select @counter = count(*) from mytable
return @counter
or
set rowcount as output parameter and print it.
or
set nocount off
greetz
|
|
|
|
|
Hi topcatalpha,
Thanks for reply,
but sp_cursoropen has one parameter which returns the total count of table. so no need to fire extra query as u said.
sp_cursoropen is sql server 2000's in built system procedure
i think there may be some other settings.
any way thanks buddy...
Krishnraj
|
|
|
|
|
With what parameters are you callin this sp. It would depend on the cursor type if the rowcount can be returned. For example if the cursor is forward only, AFAIK the actual rowcount cannot be determined.
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|