|
I wanted to know what kind of database would help me around for building a website which includes search. I will be using ASP.NET for my website and i am not sure what are the parameters which needs consideration before selecting a database.
Thanks n Regards
Nitin Goel
|
|
|
|
|
SQL Server is Microsoft's Database solution to medium to large and Enterprise level project's. I suggest anyone to use this for a ASP.NET website.
niting85 wrote: what are the parameters which needs consideration before selecting a database.
I guess this depends on the size of the project, Project requirement's, resource availability, cost and other technical factor's such as Whether Database server provides a GUI tool for Database Designing, Does it provides high Security System, and Does it provides extensive sql library functions, Referential Integrity, Triggers, Cursors, Views....
Regards - J O H N -
|
|
|
|
|
SQL Server works pretty well, a good point is that you can perform search as well on embedded Word / PDF documents.
Mmm... do you want a search on your DB, or a search in your site? If it's a search in your site you can think about using msn or google search (you can customize to search in your site), if it's an intranet another possibility is to use Sharepoint 2007 indexing capabilities (don't need to develop your site using sharepoint ), take a look at:
http://msdn.microsoft.com/msdnmag/issues/07/09/WebSearch/default.aspx?loc=en[^]
HTH
Braulio
/// -------------------------
Braulio Díez
tipsdotnet.com
/// -------------------------
|
|
|
|
|
Hi,
I have a combobox in my application on which i want to validate A-Z character entry on combo_itemsRequested Event
I dragged a regular Expresion Validator and set its property as
<asp:RegularExpressionValidator ID="revTxtdep" ValidationExpression="^(\w[a-zA-Z]+)$" Display="None" ControlToValidate="txtDeparture" runat="server" ErrorMessage="Invalid Characters Entered" SetFocusOnError="true" ValidationGroup="Search"></asp:RegularExpressionValidator>
But the probkem is that it doesnt work and i get a error stating
A potentially dangerous Request.QueryString value was detected from the client (text="aa
|
|
|
|
|
Hai all,
In my application i am using System.Net.Mail for sending mail.
for that i have used the code as given below.
MailMessage mail = new MailMessage();
MailAddress To = new MailAddress("lijorajan2004@gmail.com");
mail.To.Add(To);
mail.Body = "Hai";
MailAddress From = new MailAddress("lijo@ourdomain.com");
mail.From = From;
SmtpClient client = new SmtpClient("smtp.myserver.com");
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.Host = "hostname";//host name is our remote ip address
client.UseDefaultCredentials = false;
client.Send(mail);
here the problem is i am able to send mail to my lijo@mydomain.com(it is our own domain).but i am not able to send mail to other domain(lijorajan2004@gmail.com);
here i am getting error like "Mailbox unavailable. The server response was: 5.7.1 Unable to relay for lijorajan2004@gmail.com"
plse help me.
Thanks in advance.
Regds
Lijo
|
|
|
|
|
Your server is not allowed to relay messages that are not (either from one of it's users or to one of it's user's inbox)
So to send the message either the sender or the receiver has to be from the server's (i.e. me@myserver.com)
Nothing wrong with your code. Just the test email addresses need to be reviewed.
Cheers
Raz
/*
Ghazi Hadi Al Wadi, PMP, ASQ SSGB, DBA
*/
|
|
|
|
|
Hi,
Thank u verymuch for ur reply.If u dont mind could u plse tell me in detail how i can solve this problem?
this is my webconfig file
<system.net>
<mailSettings>
<smtp>
<network host="what i need to give here?" port="25" userName="" password="" defaultCredentials="true" />
</smtp>
</mailSettings>
</system.net>
plse help me.
regrds
Lijo
|
|
|
|
|
|
I second Braulio's openion.
As amatter of fact about 9-10 years ago a list of servers that allows relaying was published as ablack list. This was to prevent and fight spamming.
Many email servers rejected any messages comming from servers on the list.
So how can you do that: you need to be able to find the MX record of the DNS entry for each recepient, or have an account at the server you are using and then use that account to send your messages.
It is not a coding issue. It is a protocol limitation.
Cheers
Raz
/*
Ghazi Hadi Al Wadi, PMP, ASQ SSGB, DBA
*/
|
|
|
|
|
Hi
This is the first time i am using Layers in My project,but still i need to whether i am using the three layers correctly or not. Please check my code and tell where i am getting lacked or wrong. I hope your support will lead me in a right way.
In My Presentation Layer i Have following
<br />
<br />
Private Sub btnSave_ServerClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.ServerClick<br />
Dim myBLL As New NitemBLL<br />
myBLL.Group = CInt(Me.txtBG.Value)<br />
dgFilter.DataSource = myBLL.Getrecords()<br />
dgFilter.DataBind()<br />
End Sub<br />
<br />
In My Bussiness Logic Layer i Have following
<br />
Public Class NitemBLL<br />
Private _groupID As Integer<br />
Private _rhID As String = String.Empty<br />
Private _unitNo As String = String.Empty<br />
Public Property Group() As Integer<br />
Get<br />
Return _groupID<br />
End Get<br />
Set(ByVal Value As Integer)<br />
_groupID = Value<br />
End Set<br />
End Property<br />
Public Property RH() As String<br />
Get<br />
Return _rhID<br />
End Get<br />
Set(ByVal value As String)<br />
_rhID = value<br />
End Set<br />
End Property<br />
Public Property Unit() As String<br />
Get<br />
Return _unitNo<br />
End Get<br />
Set(ByVal value As String)<br />
_unitNo = value<br />
End Set<br />
End Property<br />
Public Function Getrecords() As DataSet<br />
Dim nn As New NitemDAL<br />
Return nn.Getrecord(Group)<br />
End Function<br />
In My Data Access Layer i Have following
<br />
Public Class NitemDAL<br />
<br />
Public Function Getrecord(ByVal groupid As Integer) As DataSet<br />
Dim oMyDataset As New DataSet<br />
Dim oMyAdapter As New SqlDataAdapter<br />
Dim oMyConn As SqlConnection = New SqlConnection(ConfigurationSettings.AppSettings("BBM_CONSTR"))<br />
Dim oMyCommand As SqlCommand = New SqlCommand("select cBB_Unit_No,convert(varchar(10),dBB_Donate_dt,105)[date] from blood_donate where iBloodgroup_id=" & groupid)<br />
oMyCommand.Connection = oMyConn<br />
oMyCommand.CommandType = CommandType.Text<br />
Try<br />
oMyConn.Open()<br />
oMyAdapter.SelectCommand = oMyCommand<br />
oMyAdapter.Fill(oMyDataset)<br />
oMyCommand.ExecuteNonQuery()<br />
oMyConn.Close()<br />
Catch ex As Exception<br />
ex.Message.ToString()<br />
End Try<br />
If oMyDataset.Tables(0).Rows.Count > 0 Then<br />
Return oMyDataset<br />
End If<br />
End Function<br />
<br />
I am not getting any errors. i am getting the Data Grid filled with correct values.
sathimailin
|
|
|
|
|
Your presentation and business logic layers looks fine. But I felt some problem with data layer. Data layer can be more generic and reusable. So it should contains functions that can be used in all the pages from all business logic layers.
I data layer contains functions like GetDataSet() , ExecuteNonQuery() etc.. which takes the query and type as parameters and do the operation. You should do the query formation in your business logic layer. Your query formation is very near to SQL injection attacks. You'd to prefer writing parameterized queries or stored procedures.
Hope this helps
|
|
|
|
|
Thanks Navaneeth
is This Correct?
In My Data Access Layer i changed as
<br />
Public Function Getrecord(ByVal groupid As Integer, ByVal Qry As String) As DataSet<br />
Dim oMyDataset As New DataSet<br />
Dim oMyAdapter As New SqlDataAdapter<br />
Dim oMyConn As SqlConnection = New SqlConnection(ConfigurationSettings.AppSettings("BBM_CONSTR"))<br />
Dim oMyCommand As SqlCommand = New SqlCommand(Qry)<br />
oMyCommand.Parameters.Add("@groupid", SqlDbType.Int).Value = groupid<br />
oMyCommand.Connection = oMyConn<br />
oMyCommand.CommandType = CommandType.StoredProcedure<br />
Try<br />
oMyConn.Open()<br />
oMyAdapter.SelectCommand = oMyCommand<br />
oMyAdapter.Fill(oMyDataset)<br />
oMyCommand.ExecuteNonQuery()<br />
oMyConn.Close()<br />
Catch ex As Exception<br />
ex.Message.ToString()<br />
End Try<br />
If oMyDataset.Tables(0).Rows.Count > 0 Then<br />
Return oMyDataset<br />
End If<br />
End Function<br />
In My Bussiness Logic Layer i changed as
<br />
<br />
Public Function Getrecords() As DataSet<br />
Dim nn As New NitemDAL<br />
Return nn.Getrecord(Group, "BBsearch")<br />
End Function<br />
sathimailin
|
|
|
|
|
sathimailin1 wrote: is This Correct?
There is no correct or wrong, these all are the patterns for designing. So as I said in my previous post regarding generalizing the DAL, depends on that what you have changed is wrong.
sathimailin1 wrote: Public Function Getrecord(ByVal groupid As Integer, ByVal Qry As String) As DataSet
Change this to GetDataSet() (it can be anything, it's my suggestion) with a SQLCommand array and a query as parameters. So you can use this function in all your projects.
sathimailin1 wrote: Dim oMyConn As SqlConnection = New SqlConnection(ConfigurationSettings.AppSettings("BBM_CONSTR"))
Initialize your connection in the DAL constructor, and in your function open it , do the operation and close it. Dispose this object when your DAL gets disposed.
sathimailin1 wrote: oMyCommand.Parameters.Add("@groupid", SqlDbType.Int).Value = groupid
as you are getting parameters in an array, iterate through that and add each array item to the parameter list.
sathimailin1 wrote: CommandType.StoredProcedure
If your project is using stored procedures and dynamic written queries, CommandType also can be a parameter to the above function. Rewriting such a way will make your DAL reusable.
sathimailin1 wrote: Public Function Getrecords() As DataSet
Dim nn As New NitemDAL
Return nn.Getrecord(Group, "BBsearch")
End Function
In this function create SQLParameter array and pass that along with the query to the DAL. DAL should only execute the database statements. All other procedures has to be done on business layer.
Hope this helps
|
|
|
|
|
thanks for your help Nave neeth i will try as u said
|
|
|
|
|
|
Hai Navaneeth
As u suggested i have Made some correction in DAL please go through this
In My Data Access Layer i have made corrections as
<br />
Public Function GetDataSet(ByVal Qry As String, ByVal ConnString As SqlClient.SqlConnection, ByVal ParamArray SqlParams() As SqlClient.SqlParameter) As DataSet<br />
Dim cmd As New SqlClient.SqlCommand<br />
Dim sqladpt As New SqlClient.SqlDataAdapter<br />
Dim ds As New DataSet<br />
ConnString.Open()<br />
cmd.Connection = ConnString<br />
cmd.CommandText = Qry<br />
cmd.CommandType = CommandType.StoredProcedure<br />
Attach(cmd, SqlParams)<br />
sqladpt.SelectCommand = cmd<br />
sqladpt.Fill(ds)<br />
cmd.ExecuteNonQuery()<br />
ConnString.Close()<br />
If ds.Tables(0).Rows.Count > 0 Then<br />
Return ds<br />
End If<br />
End Function<br />
<br />
<br />
Public Shared Sub Attach(ByVal cmd As SqlClient.SqlCommand, ByVal SqlParam() As SqlClient.SqlParameter)<br />
Dim p As SqlClient.SqlParameter<br />
For Each p In SqlParam<br />
cmd.Parameters.Add(p)<br />
Next p<br />
End Sub<br />
In My BLL i Made Corrcetions as
<br />
<br />
Public Class NitemBLL<br />
Private _groupID As Integer<br />
Private _rhID As String = String.Empty<br />
Private _unitNo As String = String.Empty<br />
Public Property Group() As Integer<br />
Get<br />
Return _groupID<br />
End Get<br />
Set(ByVal Value As Integer)<br />
_groupID = Value<br />
End Set<br />
End Property<br />
Public Property RH() As String<br />
Get<br />
Return _rhID<br />
End Get<br />
Set(ByVal value As String)<br />
_rhID = value<br />
End Set<br />
End Property<br />
Public Property Unit() As String<br />
Get<br />
Return _unitNo<br />
End Get<br />
Set(ByVal value As String)<br />
_unitNo = value<br />
End Set<br />
End Property<br />
Public Function Getrecords() As DataSet<br />
Dim nn As New NitemDAL<br />
<br />
Dim ConnectionString As SqlClient.SqlConnection = New SqlClient.SqlConnection(ConfigurationSettings.AppSettings("BBM_CONSTR"))<br />
<br />
Dim Param() As SqlClient.SqlParameter = New SqlClient.SqlParameter(0) {}<br />
Param(0) = New SqlClient.SqlParameter("@groupid", SqlDbType.Int)<br />
Param(0).Value = Group<br />
Return nn.GetDataSet("BBsearch", ConnectionString, Param)<br />
End Function<br />
In My Presentation Layer I Have Following
<br />
<br />
Private Sub btnSave_ServerClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.ServerClick<br />
Dim myBLL As New NitemBLL<br />
myBLL.Group = CInt(Me.txtBG.Value)<br />
dgFilter.DataSource = myBLL.Getrecords()<br />
dgFilter.DataBind()<br />
End Sub<br />
This is 3-tier Architecture with your help i think i Got good knowledge about 3-tier,i have a doubt that how this 3-tier will differ from N-Tier
|
|
|
|
|
Yes, Finally you did it. It's almost looks fine.
sathimailin1 wrote: Dim ConnectionString As SqlClient.SqlConnection = New SqlClient.SqlConnection(ConfigurationSettings.AppSettings("BBM_CONSTR"))
This connection you can create inside the DAL. in the constructor. You can write overloaded constructor which takes the connection string value also as parameter. Then if in next project, you are planning to change BBM_CONSTR , it won't be a problem.
sathimailin1 wrote: ConnString.Open()
cmd.Connection = ConnString
cmd.CommandText = Qry
cmd.CommandType = CommandType.StoredProcedure
Attach(cmd, SqlParams)
sqladpt.SelectCommand = cmd
sqladpt.Fill(ds)
cmd.ExecuteNonQuery()
ConnString.Close()
There is a chance for memory leakage in this code. Assume you got an error when executing the query, what will be the status of connection ? It will be kept open and your program will terminate. So to avoid this, put the database operation on try and catch blocks. Do database operation in try and dispose the object in catch/finally. This will avoid memory leakage.
|
|
|
|
|
N a v a n e e t h wrote: sathimailin1 wrote:
Dim ConnectionString As SqlClient.SqlConnection = New SqlClient.SqlConnection(ConfigurationSettings.AppSettings("BBM_CONSTR"))
This connection you can create inside the DAL. in the constructor. You can write overloaded constructor which takes the connection string value also as parameter. Then if in next project, you are planning to change BBM_CONSTR, it won't be a problem.
In DAL
<br />
<br />
Public Overloads Sub NitemDAL()<br />
Dim ConnectionString As SqlClient.SqlConnection = New SqlClient.SqlConnection(ConfigurationSettings.AppSettings("BBM_CONSTR"))<br />
End Sub<br />
Public Overloads Sub NitemDAL(ByVal ConnString As String)<br />
Dim ConnectionString As SqlClient.SqlConnection = New SqlClient.SqlConnection(ConfigurationSettings.AppSettings(ConnString))<br />
End Sub<br />
sorry to disturb you is this the way i created constructor but i am getting stuck that how to use this in this situation
<br />
Public Function GetDataSet(ByVal Qry As String, ByVal ConnString As SqlClient.SqlConnection, ByVal ParamArray SqlParams() As SqlClient.SqlParameter) As DataSet<br />
Dim cmd As New SqlClient.SqlCommand<br />
Dim sqladpt As New SqlClient.SqlDataAdapter<br />
Dim ds As New DataSet<br />
ConnString.Open()<br />
cmd.Connection = ConnString<br />
cmd.CommandText = Qry<br />
cmd.CommandType = CommandType.StoredProcedure<br />
<br />
Try<br />
Attach(cmd, SqlParams)<br />
sqladpt.SelectCommand = cmd<br />
sqladpt.Fill(ds)<br />
cmd.ExecuteNonQuery()<br />
Catch ex As Exception<br />
ex.Message.ToString()<br />
Finally<br />
ConnString.Close()<br />
ConnString.Dispose()<br />
End Try<br />
<br />
If ds.Tables(0).Rows.Count > 0 Then<br />
Return ds<br />
End If<br />
End Function<br />
|
|
|
|
|
sathimailin1 wrote: Public Overloads Sub NitemDAL()
Dim ConnectionString As SqlClient.SqlConnection = New SqlClient.SqlConnection(ConfigurationSettings.AppSettings("BBM_CONSTR"))
End Sub
Public Overloads Sub NitemDAL(ByVal ConnString As String)
Dim ConnectionString As SqlClient.SqlConnection = New SqlClient.SqlConnection(ConfigurationSettings.AppSettings(ConnString))
End Sub
Make the connection object public, then only you will get access to this in your GetDataSet() method,
|
|
|
|
|
sorry as a learner i am not able handle with constructor could you please guide me
<br />
Public ConnectionString As New SqlClient.SqlConnection<br />
Public Overloads Sub NitemDAL()<br />
ConnectionString = New SqlClient.SqlConnection(ConfigurationSettings.AppSettings("BBM_CONSTR"))<br />
End Sub<br />
<br />
IN Method i used as follows
<br />
Public Function GetDataSet(ByVal Qry As String, ByVal ConnString As SqlClient.SqlConnection, ByVal ParamArray SqlParams() As SqlClient.SqlParameter) As DataSet<br />
Dim cmd As New SqlClient.SqlCommand<br />
Dim sqladpt As New SqlClient.SqlDataAdapter<br />
Dim ds As New DataSet<br />
NitemDAL()<br />
cmd.Connection = ConnString<br />
cmd.CommandText = Qry<br />
cmd.CommandType = CommandType.StoredProcedure<br />
<br />
Try<br />
Attach(cmd, SqlParams)<br />
sqladpt.SelectCommand = cmd<br />
sqladpt.Fill(ds)<br />
cmd.ExecuteNonQuery()<br />
Catch ex As Exception<br />
ex.Message.ToString()<br />
Finally<br />
ConnString.Close()<br />
ConnString.Dispose()<br />
End Try<br />
<br />
If ds.Tables(0).Rows.Count > 0 Then<br />
Return ds<br />
End If<br />
End Function<br />
how to open and close connection, and also i need to know how to use constructor.
sathimailin
|
|
|
|
|
Hi all,
I am creating an asp button control in my code behind and I need to add the click event to that button and do some database transaction in that event.
Please help me with this...
Thanks in advance...
|
|
|
|
|
Button objButton = new Button();
objButton.Click += new EventHandler(objButton_Click);
You need a method to handle the event
private void objButton_Click(object sender,EventArgs e)
{
}
|
|
|
|
|
Thanks Navaneeth for reply. Actually I am creating this button in Ajax Tab control which is again created in code behind. Now the problem is will I get the tab info and other details on this button click event???
Thanks again...
|
|
|
|
|
ASP.NET 2.0 wrote: Now the problem is will I get the tab info and other details on this button click event???
I think you won't get it. I am not sure on this
|
|
|
|
|
You can do this way
Button btn = new Button();
btn.Click += new EventHandler(btn_click);
public void btn_click(object sender,EventArgs e)
{
//Code;
}
umesh
|
|
|
|