T o check case sensitive in asp .net
Private Sub checkpwd()
Dim oODBCConnection As OdbcConnection
Dim ConnString As String = "Server=LOCALHOST;" & "Database=premier;" & "provider=.NET Framework Data Provider for ODBC;" & "dsn=premier;" & "Uid=root;" & "Pwd=123456"
oODBCConnection = New Odbc.OdbcConnection(ConnString)
Dim user As String = (DirectCast(FindControl("TextBox1"), TextBox)).Text
Dim pswd As String = (DirectCast(FindControl("TextBox2"), TextBox)).Text
Dim pwdqry As String = "Select Password from log_auth where username=? and password=?"
Dim pwdcmd As New OdbcCommand(pwdqry, oODBCConnection)
pwdcmd.Parameters.AddWithValue("@user", User)
pwdcmd.Parameters.AddWithValue("@pswd", pswd)
MsgBox(User)
MsgBox(pswd)
oODBCConnection.Open()
Dim dr1 As OdbcDataReader = pwdcmd.ExecuteReader
' dr1 = pwdcmd.ExecuteReader
If dr1.Read() Then
'MsgBox(dr1(0))
Dim enterpwd As String = dr1(0)
MsgBox(enterpwd)
End If
Dim res As String
res = String.Compare(pswd, dr1(0), False)
MsgBox(res)
If res = "0" Then
MsgBox("matching password")
Response.Redirect("Default.aspx")
Else
MsgBox("Password is not correct")
End If
End Sub
Note: To check case sensitive using compare string in “res = String.Compare(pswd, dr1(0), False)”
To check login username and Password:
Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim user As String = (DirectCast(FindControl("TextBox1"), TextBox)).Text
Dim pswd As String = (DirectCast(FindControl("TextBox2"), TextBox)).Text
Dim oODBCConnection As OdbcConnection
Dim ConnString As String = "Server=LOCALHOST;" & "Database=premier;" & "provider=.NET Framework Data Provider for ODBC;" & "dsn=premier;" & "Uid=root;" & "Pwd=123456"
oODBCConnection = New Odbc.OdbcConnection(ConnString)
Dim myselectQuery As String = "Select * from log_auth where username=? and password=?"
Dim myOdbcCommand As New OdbcCommand(myselectQuery, oODBCConnection)
myOdbcCommand.Parameters.AddWithValue("@user", user)
myOdbcCommand.Parameters.AddWithValue("@pswd", pswd)
oODBCConnection.Open()
Dim dr As OdbcDataReader
dr = myOdbcCommand.ExecuteReader
If dr.HasRows Then
checkpwd()
Else
Label3.Text = "User not authenticated to login this page"
'MsgBox("User not authenticated to login this page")
End If
'myOdbcCommand.ExecuteNonQuery()
'oODBCConnection.Close()
End Sub
To go from one aspx to another aspx page:
Response.Redirect("Default.aspx");
To Hide and unhide columns in gridview1
Gridview1.Columns(x).Visible = False
Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
Label1.Visible = False
DropDownList1.Visible = False
Button1.Visible = False
GridView1.Visible = True
GridView1.Columns(0).Visible = True
GridView1.Columns(1).Visible = True
GridView1.Columns(2).Visible = True
GridView1.Columns(3).Visible = False
GridView1.Columns(4).Visible = True
'GridView1.Columns(5).Visible = True
'MsgBox("database checked")
End Sub
TO get results In button_click, rediobutton.checkchanges
Change properties as AutoPostback = False
Note: to execute code in events and actions for buttons or pages.
Autopostback: Automatically Postback to the server when the control is clicked.
To create dropdownlist and populate values for that dropdown in page
'Dim myselectQuery As String = "SELECT dsn_id, dsn_name FROM premier.rm_dsn_source"
Dim myOdbcCommand As New OdbcCommand("SELECT dsn_id, dsn_name FROM premier.rm_dsn_source", oODBCConnection)
If oODBCConnection.State = ConnectionState.Closed Then
oODBCConnection.Open()
End If
Dim myDA As OdbcDataAdapter
Dim myDataSet As DataSet
myDA = New OdbcDataAdapter(myOdbcCommand)
myDataSet = New DataSet()
myDA.Fill(myDataSet, "MyTable")
If myDataSet.Tables(0).Rows.Count > 0 Then
'GridView1.DataSource = myDataSet.Tables("MyTable").DefaultView
'GridView1.DataSource = myDataSet.Tables("MyTable").DefaultView
'GridView1.DataSource = SqlDataSource1
DropDownList1.DataSource = myDataSet.Tables(0)
DropDownList1.DataTextField = "dsn_name"
DropDownList1.DataValueField = "dsn_id"
MsgBox(GridView1.Columns.Count)
DropDownList1.DataBind()
DropDownList1.Items.Insert(0, "--Select--")
Else
MsgBox("no database available")
End If
Code for dropdownlist field:
'----odbc connection - start
Dim oODBCConnection As OdbcConnection
Dim ConnString As String = "Server=LOCALHOST;" & "Database=premier;" & "provider=.NET Framework Data Provider for ODBC;" & "dsn=premier;" & "Uid=root;" & "Pwd=123456"
oODBCConnection = New System.Data.Odbc.OdbcConnection(ConnString)
oODBCConnection.Open()
'----odbc connection - end
'----------code to get details for dropdownlist values- start
'Dim myselectQuery As String = "SELECT dsn_id, dsn_name FROM premier.rm_dsn_source"
Dim myOdbcCommand As New OdbcCommand("SELECT dsn_id, dsn_name FROM premier.rm_dsn_source", oODBCConnection)
Dim myDA As OdbcDataAdapter
Dim myDataSet As DataSet
myDA = New OdbcDataAdapter(myOdbcCommand)
myDataSet = New DataSet()
myDA.Fill(myDataSet, "MyTable")
If myDataSet.Tables(0).Rows.Count > 0 Then
'GridView1.DataSource = myDataSet.Tables("MyTable").DefaultView
'GridView1.DataSource = myDataSet.Tables("MyTable").DefaultView
'GridView1.DataSource = SqlDataSource1
DropDownList1.DataSource = myDataSet.Tables(0)
DropDownList1.DataTextField = "dsn_name"
DropDownList1.DataValueField = "dsn_id"
DropDownList1.DataBind()
DropDownList1.Items.Insert(0, "--Select--")
Else
MsgBox("no database available")
End If
'----------code to get details for dropdownlist - end
Thursday, May 26, 2011
Tuesday, July 27, 2010
Everyone have their own laws
Everyone have their own laws to follow, others are citizens depends on their activities they will be accused or praised,
Someone accept drinks, cigarette as 'not bad', even brothel also but others point of view that should be punished......If we don't like or can't okay with that, that is bad as far as everyone concerned, when women starts to smoke and they are telling that is not bad, if it's in limit, limit also they describing and they started drinks also and other things also....in dark side..
If one like that or one am okay to do that, that is good, that is definition for good to all..others_______,
And when business man or who have power breaking law means that is not bad or wrong, money and power play role to decide good and bad in country.....
but i believe final judgment day(Everyday)......will get what we are giving only.......
Someone accept drinks, cigarette as 'not bad', even brothel also but others point of view that should be punished......If we don't like or can't okay with that, that is bad as far as everyone concerned, when women starts to smoke and they are telling that is not bad, if it's in limit, limit also they describing and they started drinks also and other things also....in dark side..
If one like that or one am okay to do that, that is good, that is definition for good to all..others_______,
And when business man or who have power breaking law means that is not bad or wrong, money and power play role to decide good and bad in country.....
but i believe final judgment day(Everyday)......will get what we are giving only.......
Monday, July 19, 2010
Good after the bad.....and Bad after the Good...
We can't stop "Good after the bad and bad after the Good".
For every man in this world some good things will come after some bad things and also some bad things will come after some good things.......Hard to believe, If not realized..:-)
Even Good man would get bad things and Bad man would get good things. We can stop this cycle, whatever we are doing reflects the result of "good" sometime and also "bad" sometimes, Even if we don't do anything.....
Cycle always rotate for all peoples like this, But the good person with his truth, honest, fearless and wishes from good persons will save them, when they get "bad"...
But Bad mans with their irrespective with humans and bad characters will destroy(show) them, when "bad" comes to their life...
And finally all the persons in this world will get good and bad things in this world always as per cycle............:-)
For every man in this world some good things will come after some bad things and also some bad things will come after some good things.......Hard to believe, If not realized..:-)
Even Good man would get bad things and Bad man would get good things. We can stop this cycle, whatever we are doing reflects the result of "good" sometime and also "bad" sometimes, Even if we don't do anything.....
Cycle always rotate for all peoples like this, But the good person with his truth, honest, fearless and wishes from good persons will save them, when they get "bad"...
But Bad mans with their irrespective with humans and bad characters will destroy(show) them, when "bad" comes to their life...
And finally all the persons in this world will get good and bad things in this world always as per cycle............:-)
Friday, June 25, 2010
XML Publisher date format problems..
I faced one different problem in Rtf template for XML publisher.....
when i tried to get the date format as "mm/dd/yyyy"(as default the date format would come as 'yyyy-mm-dd), I just changed the date format in field properties(Text form field Options) that format and ran that report, I got the dates one day less to that actual date, for ex., if the actual date is 02/02/2010, In report it came as 02/01/2010,
When i tried to any date format in Field properties, it is coming like this.
So instead of this I used the below code in (text form field options -> add help text)
It is working fine now....
when i tried to get the date format as "mm/dd/yyyy"(as default the date format would come as 'yyyy-mm-dd), I just changed the date format in field properties(Text form field Options) that format and ran that report, I got the dates one day less to that actual date, for ex., if the actual date is 02/02/2010, In report it came as 02/01/2010,
When i tried to any date format in Field properties, it is coming like this.
So instead of this I used the below code in (text form field options -> add help text)
It is working fine now....
To view file attachment in peoplesoft - getting from webserver file web.xml
While viewing any attachment, we may get some trouble to open some files. It depends on File extention which is defined in the file web.xml in webserver..Here for example .doc files couldn't open in View attachment..For this case..
Please check the web.xml file as given in peoplebooks.......
"The web server determines the MIME type by looking at the extension of the attachment file and mapping it to a MIME type. The mapping is done in the following ways, depending on the web server and platform:
For Microsoft IIS, the mapping is done by using the standard Microsoft Windows extension association mechanism.
For Apache, the mapping is done by editing a configuration file called mime.types.
For WebLogic, a file called web.xml does the mapping.
The file web.xml is located in the WEB-INF subdirectory. This file contains a section that looks like this:

this file might be in your webserv folder.....
\FS89DMO\webserv\applications\peoplesoft\PORTAL\WEB -INF\ Web.xml
Please check and confirm once, you have the all file types on this....
Please check the web.xml file as given in peoplebooks.......
"The web server determines the MIME type by looking at the extension of the attachment file and mapping it to a MIME type. The mapping is done in the following ways, depending on the web server and platform:
For Microsoft IIS, the mapping is done by using the standard Microsoft Windows extension association mechanism.
For Apache, the mapping is done by editing a configuration file called mime.types.
For WebLogic, a file called web.xml does the mapping.
The file web.xml is located in the WEB-INF subdirectory. This file contains a section that looks like this:

this file might be in your webserv folder.....
\FS89DMO\webserv\applications\peoplesoft\PORTAL\WEB -INF\ Web.xml
Please check and confirm once, you have the all file types on this....
Thursday, June 24, 2010
Viewing File Attachments - setup with webserver
Viewing File Attachments
When viewing a file attachment, the browser invokes a viewer based on the content-type Multipurpose Internet Mail Extensions (MIME) category sent in the response header from the web server.
For example, if the user tried to view an MP3 file, the response header sent to the browser by the web server would indicate the audio/MPEG content type.
HTTP/1.1 200 OK
Server: Microsoft-IIS/5.0
Date: Mon, 01 Oct 2001 21:25:51
GMT Content-Type: audio/mpeg Accept-Ranges:
bytes Last-Modified: Mon, 01 Oct 2001 21:00:26
GMT ETag: "78e21918bc4ac11:cc8"
Content-Length: 60
Notice that the Content-Type is audio/mpeg. The browser uses this MIME type to determine that a viewer for audio/MPEG is appropriate. If the web server did not send this content-type header, the browser would not be able to determine the nature of the file being transmitted, and it would be unable to invoke the correct application. The browser would try to display the file as text/plain, which might be the wrong assumption.
The web server determines the MIME type by looking at the extension of the attachment file and mapping it to a MIME type. The mapping is done in the following ways, depending on the web server and platform:
*
For Microsoft IIS, the mapping is done by using the standard Microsoft Windows extension association mechanism.
*
For Apache, the mapping is done by editing a configuration file called mime.types.
*
For WebLogic, a file called web.xml does the mapping.
The file web.xml is located in the WEB-INF subdirectory. This file contains a section that looks like this:
doc
application/msword
xls
application/vnd.ms-excel
Let's say you want to add an extension that causes log files to be interpreted as plain text files.
To determine the correct MIME type, check Request for Comments (RFC) documents 2045, 2046, 2047, 2048, and 2077, which discuss internet media types and the internet media type registry.
After checking the RFCs, you determine that the correct MIME type is text/plain. The following is an example of code you would add to the previous section of web.xml:
doc
application/msword
log
text/plain
xls
application/vnd.ms-excel
Once you save the file, the log extension is associated with the content type of text/plain.
Note. You must restart the WebLogic server before these changes are recognized.
Similar mappings can be achieved on other web servers, such as IBM WebSphere or Netscape Enterprise Server.
See your web server documentation.
Note. When trying to view the objects, the extension must exactly match what is set up in the web.xml file. This value is case-sensitive. If the object view appears garbled, chances are that either the extension is not set up in the web.xml file or there is a case mismatch.
source: http://download.oracle.com/docs/cd/E15645_01/pt850pbr0/eng/psbooks/tpcd/book.htm?File=tpcd/htm/tpcd11.htm#H3002
When viewing a file attachment, the browser invokes a viewer based on the content-type Multipurpose Internet Mail Extensions (MIME) category sent in the response header from the web server.
For example, if the user tried to view an MP3 file, the response header sent to the browser by the web server would indicate the audio/MPEG content type.
HTTP/1.1 200 OK
Server: Microsoft-IIS/5.0
Date: Mon, 01 Oct 2001 21:25:51
GMT Content-Type: audio/mpeg Accept-Ranges:
bytes Last-Modified: Mon, 01 Oct 2001 21:00:26
GMT ETag: "78e21918bc4ac11:cc8"
Content-Length: 60
Notice that the Content-Type is audio/mpeg. The browser uses this MIME type to determine that a viewer for audio/MPEG is appropriate. If the web server did not send this content-type header, the browser would not be able to determine the nature of the file being transmitted, and it would be unable to invoke the correct application. The browser would try to display the file as text/plain, which might be the wrong assumption.
The web server determines the MIME type by looking at the extension of the attachment file and mapping it to a MIME type. The mapping is done in the following ways, depending on the web server and platform:
*
For Microsoft IIS, the mapping is done by using the standard Microsoft Windows extension association mechanism.
*
For Apache, the mapping is done by editing a configuration file called mime.types.
*
For WebLogic, a file called web.xml does the mapping.
The file web.xml is located in the WEB-INF subdirectory. This file contains a section that looks like this:
doc
application/msword
xls
application/vnd.ms-excel
Let's say you want to add an extension that causes log files to be interpreted as plain text files.
To determine the correct MIME type, check Request for Comments (RFC) documents 2045, 2046, 2047, 2048, and 2077, which discuss internet media types and the internet media type registry.
After checking the RFCs, you determine that the correct MIME type is text/plain. The following is an example of code you would add to the previous section of web.xml:
doc
application/msword
log
text/plain
xls
application/vnd.ms-excel
Once you save the file, the log extension is associated with the content type of text/plain.
Note. You must restart the WebLogic server before these changes are recognized.
Similar mappings can be achieved on other web servers, such as IBM WebSphere or Netscape Enterprise Server.
See your web server documentation.
Note. When trying to view the objects, the extension must exactly match what is set up in the web.xml file. This value is case-sensitive. If the object view appears garbled, chances are that either the extension is not set up in the web.xml file or there is a case mismatch.
source: http://download.oracle.com/docs/cd/E15645_01/pt850pbr0/eng/psbooks/tpcd/book.htm?File=tpcd/htm/tpcd11.htm#H3002
Friday, March 26, 2010
Subscribe to:
Comments (Atom)
