Thursday, June 09, 2005

VS 2005 Beta

Now after looking at it a bit closer, i found out that Visual Basic with VS.NET 1.X was a mistake, vB 8 should have been released after VB 6.
As they have brought back all the goodies of VB 6 in VB 8. So the ppl that have not yet picked up VB 7, should just forget about it and start thereselves of with VB 8, that is with VS 2005.

Enjoy IT!

Wednesday, June 08, 2005

Create Insert Procedure for Tables

--Hope this is usefull, atleast it is for me

--USE DatabaseName

DECLARE @TABLENAME VARCHAR(100)
DECLARE @COLNAME VARCHAR(100)
DECLARE @COLTYPE VARCHAR(100)
DECLARE @LENGTH VARCHAR(100)
DECLARE @PROCEDURE VARCHAR(8000)

DECLARE ALLTABLES CURSOR FOR
SELECT NAME FROM SYSOBJECTS WHERE XTYPE='U' AND SYSSTAT <> 8275
ORDER BY NAME

OPEN ALLTABLES

FETCH NEXT FROM ALLTABLES INTO @TABLENAME

WHILE @@FETCH_STATUS = 0
BEGIN
--PRINT ''
SET @PROCEDURE = ''
--PRINT 'CREATE PROCEDURE AP_' + @TABLENAME + '_INSERT '
SET @PROCEDURE = @PROCEDURE + 'CREATE PROCEDURE ' + @TABLENAME + '_INSERT ' + CHAR(13)
--PRINT '('
SET @PROCEDURE = @PROCEDURE + '(' + CHAR(13)
--BEGIN PROCEDURE
DECLARE ALLCOLS CURSOR FOR
SELECT SC.[NAME],ST.[NAME], SC.LENGTH FROM
SYSOBJECTS SO INNER JOIN SYSCOLUMNS SC ON SO.ID = SC.ID
INNER JOIN SYSTYPES ST ON SC.XUSERTYPE = ST.XUSERTYPE
WHERE SO.XTYPE='U' AND SYSSTAT <> 8275 AND SO.[NAME] = @TABLENAME
OPEN ALLCOLS

FETCH NEXT FROM ALLCOLS INTO @COLNAME, @COLTYPE, @LENGTH
WHILE @@FETCH_STATUS = 0
BEGIN
--PRINT '@' + @COLNAME + ' ' + @COLTYPE
SET @PROCEDURE = @PROCEDURE + '@' + @COLNAME + ' ' + @COLTYPE
FETCH NEXT FROM ALLCOLS INTO @COLNAME, @COLTYPE, @LENGTH
if @@FETCH_STATUS = 0
BEGIN
--PRINT ', '
SET @PROCEDURE = @PROCEDURE + ', ' + CHAR(13)
END
END

CLOSE ALLCOLS
OPEN ALLCOLS
--SET @PROCEDURE = @PROCEDURE + CHAR(13)
--PRINT ') AS '
SET @PROCEDURE = @PROCEDURE + CHAR(13) + ')' + CHAR(13) + 'AS ' + CHAR(13)
--PRINT ' INSERT INTO ' + @TABLENAME + ' ('
SET @PROCEDURE = @PROCEDURE + 'INSERT INTO ' + @TABLENAME + ' ('

FETCH NEXT FROM ALLCOLS INTO @COLNAME, @COLTYPE, @LENGTH
WHILE @@FETCH_STATUS = 0
BEGIN
--PRINT @COLNAME
SET @PROCEDURE = @PROCEDURE + @COLNAME
FETCH NEXT FROM ALLCOLS INTO @COLNAME, @COLTYPE, @LENGTH
if @@FETCH_STATUS = 0
BEGIN
--PRINT ', '
SET @PROCEDURE = @PROCEDURE + ', '
END
END
CLOSE ALLCOLS
OPEN ALLCOLS

--PRINT ') VALUES ('
SET @PROCEDURE = @PROCEDURE + ') ' + CHAR(13) + 'VALUES ('

FETCH NEXT FROM ALLCOLS INTO @COLNAME, @COLTYPE, @LENGTH
WHILE @@FETCH_STATUS = 0
BEGIN
--PRINT ' @' + @COLNAME
SET @PROCEDURE = @PROCEDURE + '@' + @COLNAME
FETCH NEXT FROM ALLCOLS INTO @COLNAME, @COLTYPE, @LENGTH
if @@FETCH_STATUS = 0
BEGIN
--PRINT ', '
SET @PROCEDURE = @PROCEDURE + ', '
END
END
CLOSE ALLCOLS
DEALLOCATE ALLCOLS
--PRINT ')'
SET @PROCEDURE = @PROCEDURE + ')'
SET @PROCEDURE = @PROCEDURE + CHAR(13) + CHAR(13)
PRINT @PROCEDURE

--SELECT @PROCEDURE
--END PROCEDURE
FETCH NEXT FROM ALLTABLES INTO @TABLENAME
END
CLOSE ALLTABLES
DEALLOCATE ALLTABLES


--Enjoy IT!

Tuesday, June 07, 2005

Visual Studio 2005 Beta

At last got the VS.NET 2005 Beta CD's yesterday from Microsoft Germany through DHL,
now have to install and Run!!!


Try IT and Enjoy!

Changing Character Case in VB.NET

I wanted to change the case of characters in some textboxes,
i tried using the KeyPress, KeyDown, TextChange events, but to no use.
While searching the net, i found a very very simple solution to this,
there is a property for TextBox named "CharacterCasing" :D.
Just change it to Upper or Lower, as requirements.

But you know what, there should be another way of doing this,
have to search a bit more.

Enjoy IT.