protected void Page_Load(object sender, EventArgs e)
{
string currentUrl = "http://localhost:39211/?page=2&sort=1&link=12&category=papers";
string result = RemoveQueryString(currentUrl, "link");
Response.Write(result);
}
public string RemoveQueryString(string url, string key)
{
string pattern = key + "=[^&]+&?";
System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex(pattern);
return regex.Replace(url, "");
}
Wednesday, June 5, 2013
Tuesday, May 22, 2012
defaulttest
add name="constr" connectionString="Data Source=JAGDISH;Initial Catalog=jaincmsdb;Integrated Security=false;" providerName="System.Data.SqlClient"
add name="constr" connectionString="Initial Catalog=tourdb;Data Source=JAGDISH;Integrated Security=SSPI;"
add name="constr" connectionString="Data Source=XP8\SQL2008;Initial Catalog=jaincmsdb;User ID=sa;Password=sasql;" providerName="System.Data.SqlClient"
add name="constr" connectionString="Data Source=174.122.105.131;Initial Catalog=jaincmsdb;User ID=pathik;Password=pathik123;" providerName="System.Data.SqlClient"
testing
Imports Microsoft.VisualBasic
Imports System.Data
Imports System.Data.SqlClient
Imports DAL
Namespace DAL
Public Class db
'''
''' Function return connection string with open state
'''
'''
'''
Public Function OpenConnection() As SqlConnection
SqlConnection.ClearAllPools()
Dim str As String = ""
str = ConfigurationManager.ConnectionStrings("con").ConnectionString
Dim cn As New SqlConnection
cn.ConnectionString = str
cn.Open()
Return cn
End Function
'''
''' Function use the execute non query
'''
'''
'''
'''
Public Sub ExecuteNonQuery(ByVal strQuery As String, Optional ByVal strFunctionName As String = "")
HttpContext.Current.Trace.Warn(strFunctionName & ":" & strQuery)
Dim cn As New SqlConnection
Dim cmd As New SqlCommand
Try
cn = OpenConnection()
cmd.Connection = cn
cmd.CommandType = CommandType.Text
cmd.CommandText = strQuery
cmd.ExecuteNonQuery()
Finally
cn.Close()
End Try
End Sub
'''
''' Function return dataset
'''
'''
'''
'''
Public Function FillDataset(ByVal strQuery As String, Optional ByVal strFunctionName As String = "") As DataSet
HttpContext.Current.Trace.Warn(strFunctionName & ":" & strQuery)
Dim cn As New SqlConnection
Dim cmd As New SqlCommand
Dim dst As New DataSet
Dim da As New SqlDataAdapter
Try
cn = OpenConnection()
cmd.Connection = cn
cmd.CommandType = CommandType.Text
cmd.CommandText = strQuery
cmd.ExecuteNonQuery()
da = New SqlDataAdapter(cmd)
da.Fill(dst)
Finally
cn.Close()
End Try
Return dst
End Function
'''
''' Function return dataset
'''
'''
'''
'''
Public Function FillDatareader(ByVal strQuery As String, Optional ByVal strFunctionName As String = "") As SqlDataReader
HttpContext.Current.Trace.Warn(strFunctionName & ":" & strQuery)
Dim cn As New SqlConnection
Dim cmd As New SqlCommand
Dim dr As SqlDataReader
cn = OpenConnection()
cmd.Connection = cn
cmd.CommandType = CommandType.Text
cmd.CommandText = strQuery
dr = cmd.ExecuteReader()
Return dr
End Function
End Class
End Namespace
Imports System.Data
Imports System.Data.SqlClient
Imports DAL
Namespace DAL
Public Class db
'''
''' Function return connection string with open state
'''
'''
'''
Public Function OpenConnection() As SqlConnection
SqlConnection.ClearAllPools()
Dim str As String = ""
str = ConfigurationManager.ConnectionStrings("con").ConnectionString
Dim cn As New SqlConnection
cn.ConnectionString = str
cn.Open()
Return cn
End Function
'''
''' Function use the execute non query
'''
'''
'''
'''
Public Sub ExecuteNonQuery(ByVal strQuery As String, Optional ByVal strFunctionName As String = "")
HttpContext.Current.Trace.Warn(strFunctionName & ":" & strQuery)
Dim cn As New SqlConnection
Dim cmd As New SqlCommand
Try
cn = OpenConnection()
cmd.Connection = cn
cmd.CommandType = CommandType.Text
cmd.CommandText = strQuery
cmd.ExecuteNonQuery()
Finally
cn.Close()
End Try
End Sub
'''
''' Function return dataset
'''
'''
'''
'''
Public Function FillDataset(ByVal strQuery As String, Optional ByVal strFunctionName As String = "") As DataSet
HttpContext.Current.Trace.Warn(strFunctionName & ":" & strQuery)
Dim cn As New SqlConnection
Dim cmd As New SqlCommand
Dim dst As New DataSet
Dim da As New SqlDataAdapter
Try
cn = OpenConnection()
cmd.Connection = cn
cmd.CommandType = CommandType.Text
cmd.CommandText = strQuery
cmd.ExecuteNonQuery()
da = New SqlDataAdapter(cmd)
da.Fill(dst)
Finally
cn.Close()
End Try
Return dst
End Function
'''
''' Function return dataset
'''
'''
'''
'''
Public Function FillDatareader(ByVal strQuery As String, Optional ByVal strFunctionName As String = "") As SqlDataReader
HttpContext.Current.Trace.Warn(strFunctionName & ":" & strQuery)
Dim cn As New SqlConnection
Dim cmd As New SqlCommand
Dim dr As SqlDataReader
cn = OpenConnection()
cmd.Connection = cn
cmd.CommandType = CommandType.Text
cmd.CommandText = strQuery
dr = cmd.ExecuteReader()
Return dr
End Function
End Class
End Namespace
Subscribe to:
Posts (Atom)