Monday, July 5, 2010

Software Da Philips 7130

Since filtering a datetime field in my query as a parameter having a single date in SQL Server

We have a table that other fields also included the date, but it turns out that we have declared a data type "DateTime" and that by default when creating or editing the registry, this field also includes the time , minutes, seconds and milliseconds (08/06/2007 12:23:56.234) which was updated.

This can be a headache when performing a search in which we as a criterion for selecting the date field, and usually parameterize filter or different format and date: Select * from WHERE date purchases = '08 / 06/2007 '. And the result would be: Damn, I have no records.

Well I bring you a simple solution by means of a function made in SQL Server where you can filtrais no more trouble than run:

CREATE FUNCTION [dbo] . [CONVERT_FECHA_SIMPLE]

(

@ DATE DATETIME

)

RETURNS SMALLDATETIME

AS

BEGIN

RETURN CAST ( CONVERT (varchar , @ DATE, 103 ) AS DATETIME )

END


Well, after this code, here deberais only thing you do in your stored procedure which will make the long-awaited consultation is call the function from the field convert_fecha_simple criterion, so, you look:

Shopping Select * from dbo.convert_fecha_simple WHERE (date) = '08 / 06/2007 '

Friday, July 2, 2010

Recorder Ocean City,md

Perform a search in a table for each of its columns in SQL Server data

In our form we are vb.net idea of \u200b\u200bshowing a list or a grid results in a specific search of the records in a table and it would have to filter out keywords based on your type of columns they contain.

This could be very useful for those using one or a few tables in SQL Server to locate the desired records and also for those who want to show the results using a single criterion and not complicated a host of specific controls for each word or key data.

All this adds up to make a stored procedure in SQL Server in which OJO! only will the example procedure in which data would be stored and the alias name of the assigned columns in the tables or queries which will search the records, and is obvious that apart and you will have a procedure or view in the which shall consult the records.

Code in SQL Server:

CREATE PROCEDURE SP_COLUMNAS_TABLA

@ TABLE VARCHAR (20 )

AS

BEGIN

- Create a temporary table which stores NAMES OF THE COLUMNS AND CHOOSE ALIAS FOR EACH TABLE

DECLARE @ TABLA_COLUMNAS TABLE (COLUMN varchar ( 50 ) DESCRIPTION varchar (50 ))

SET NOCOUNT ON

DECLARE @COLUMNA AS VARCHAR ( 50 )

DECLARE @ARRAY_COL AS NVARCHAR ( 500 )

DECLARE @DESCRIPCION AS VARCHAR ( 50 )

DECLARE @ ARRAY_DES AS NVARCHAR (500 )

IF @ TABLE = 'PEOPLE' BEGIN

SET @ ARRAY_COL = 'COD_PERSONA, NAME, FECHA_NACIMIENTO, '- NAMES OF THE COLUMNS IN THE TABLE1 WE WANT FILTER IN THE SEARCH, THIS BOARD MIGHT HAVE oviously more columns, JUST SELECT WE WANT THE SHOW

SET @ ARRAY_DES = 'CODE, NAME, DATE OF BIRTH,' - ALIAS COLUMN IN ORDER FOR THE NAME OF THIS FORM DESCRIBE THE TIME TO SHOW IN A FORM OF CONTROL

END

IF @ TABLA = 'CIUDADES' BEGIN

SET @ARRAY_COL = ' COD_CIUDAD,NOMBRE,'

SET @ARRAY_DES = 'CODE, NAME,'

END

- you can even choose more columns in a table consultation


IF @ TABLE = 'CIUDAD_PERSONAS' BEGIN

SET @ ARRAY_COL = 'CIUDADES.NOMBRE , PERSONAS.NOMBRE '

SET @ ARRAY_DES = ' CITY, PERSON, '

END

WHILE LEN ( @ARRAY_COL ) <> 0

BEGIN

SET @COLUMNA = SUBSTRING ( @ARRAY_COL , 0 , CHARINDEX ( ',' , @ARRAY_COL ))

SET @ARRAY_COL = SUBSTRING ( @ARRAY_COL , CHARINDEX ( ',' , @ARRAY_COL , 0 )+ 1 , LEN ( @ARRAY_COL ))

SET @DESCRIPCION = SUBSTRING ( @ARRAY_DES , 0 , CHARINDEX ( ',' , @ARRAY_DES ))

SET @ARRAY_DES = SUBSTRING ( @ARRAY_DES , CHARINDEX ( ',' , @ARRAY_DES , 0 )+ 1 , LEN ( @ARRAY_DES ))

INSERT INTO @TABLA VALUES ( @COLUMNA , @DESCRIPCION )

END

SELECT * FROM @ TABLA_COLUMNAS

END


But if you are from what is not want to complicate even more with this code, and want a Porrasa all columns in a table and all the user chooses to filter the search field then I recommend using this code in SQL Server:

Select name from syscolumns WHERE id = object_id ( 'table_name' )


Well here it is clear that will not put the code vb.net to invoke this procedure and make the search string, it is up to each developer, here only gave them an idea of \u200b\u200bhow they could solve in a practical way the search in a specific table or query. The search filter would be more or less like this:


How To Lay A Floor In A Boat

Remember username and password login in a practical way


infatuated
Sometimes we are looking for an effective and reliable solution to our application to establish functional attributes that we miss the idea of \u200b\u200ba practical solution rather simple. For example one of these would be the attempt to attribute to our form login remember our ownership of data if they wish.

had investigated several articles in which by the grace of St. google I ran into types and delivering asking you to work with coockie, yes, that archivito in text format that is indispensable for those who have not the slightest time to re-enter your user details to access your favorite site. However, if such insurance will not vb.Ne code that you permitais estois t attributes, but it's too tedious to be referencing libraries and writing code that may never will understand, so I oz say do not complicate life and develop your own coockie with the following example in vb.Net :

Private Sub Btn_Aceptar_Click ( ByVal sender As System.Object, ByVal e As System.EventArgs ) Handles Btn_Aceptar.Click

Const RutaCockie As String = "C: \\ cockie.txt"

If ChkRecordar.Checked = True Then 'activate the check if we save the data file texo

Dim sw As New System.IO.StreamWriter (RutaCockie)

sw.WriteLine (Txt_NomUsu.Text)

sw.WriteLine (Txt_ClaUsu.Text) 'well you have no doubt the key coded or otherwise any cat could investigate the Cockies curious and watch the absurdity of your password: porsiempretuyo123

sw.Close ()

Else

If IO.File.Exists (RutaCockie) Then

My . Computer.FileSystem.DeleteFile (RutaCockie) 'I recommend you delete the file if you have saved before and now regret oz to it first if the file comprobareis existeis

End If

End If

End Sub

Private Sub Form1_Load( ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase .Load

Const RutaCockie As String = "C: \\ cockie.txt" 'may be another route, curse you desire, all the rights of free expression will take shelter

If IO.File.Exists (RutaCockie) Then 'if file exists, it means that guardastes coockie data in each line and read the text data

ChkRecordar.Checked = True

Dim sr As New System.IO.StreamReader (RutaCockie, True )

sr.ReadLine Txt_NomUsu.Text = 'read the first line where I would be the name user in that order because it should've saved

Txt_ClaUsu.Text = sr.ReadLine 'Leea the second line

sr.Close ()

End If

End Sub

What Kind Of Weave Does Myammee Wear

vb.Net Why does my file downloaded from my FTP server is not saved in the folder you create from my application in vb.Net?

These compiling your application in vb.Net to download files from FTP server and all leaves you perfectly, that is, connect to the FTP Server, your downloaded file is saved in the folder you've assigned from source in the path of your application by default, ie "c: \\ Program Files \\ My Application \\ FTP Files \\ file.doc. " Suddenly, you go to another machine, install your application to test (As you have to brag) and you realize that your downloaded file that supposedly does not appear in the folder you want what happened?

The reason for this little problem?: To be honest I'm not sure but it appears that this is the Windows permissions as these folders are special and can not be altered from a source other than the user's direct actions same as save, delete, modify files (which contain) from the inside, on the contrary because we want to alter from an intermediate source using our application, we would need a special code that allows us to do just these actions within folders in question.

Gentlemen, I would recommend the following: Avoid downloading in a direction which may include operating system folder (Windows, Program Files, My Documents, etc), commonly (I assume) would for example "c: \\ Program Files \\ My System \\ FTP Files \\ file.doc "because it could cause an error or at least show no error ! but instead not save the file! (What happened in my case), so avoid it and do not complicate, I suggest you save it to another drive or eg "C: \\ Archid FTP." O If you get some code or property that allows us to perform these actions please share them man!, much better if publicais our blog, your alternative solution.

Here I leave the code to guide vb.Net:


Dim filepath As String

'If the folder where we want to keep our files not created, because they believe, what we as

If Not Directory.Exists ( "C: \\ FTP" ) Then

Directory.CreateDirectory ( "C: \\ FTP" )

End If

filepath = "c : \\ FTP Files \\ archivodescargado.doc "


'important, it is necessary to check if the file already exists to open or run (if that's your intention) directly and not send another Once the download request FTP server

If Not File.Exists (filepath) Then

Try

DescargarArchivoFTP (filepath, "archivodescargado.doc" ) 'Click here for the procedure in which the file download

Catch ex As Exception

MsgBox(ex.Message)

Exit Sub

End Try

End If

End If

Try

System.Diagnostics.Process.Start (filepath) 'if your intension is to open the file oejecutar

GrabarEstado ()

Catch ex As Exception

MsgBox (ex.Message)

End Try