|
Dear Holmes,
I am not proffessional in SQL Server...can you please tell me how to do that (create and schedule a job) that send email when insert happens on MyTable???
Thanks
Kind Regards
OBarahmeh
|
|
|
|
|
Hi, I'm still a beginner in this. Creating code in vb to log in a user. The username and password typed into the textbox must be verified against the username and password in the database. I use a SqldataReader to perform this action but can't seem to get the syntax correct... please can you help me.
Here is the Function and the relevant button :
Protected Sub butLogin_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles butLogin.Click
If CheckPassword(txtusername.Text, txtpassword.Text) Then
'FormsAuthentication.RedirectFromLoginPage(txtusername.Text, True)
Response.Redirect("Default.aspx")
Else
MsgBox("username or password not found. try again")
End If
End Sub
Private Function CheckPassword(ByVal username As String, ByVal password As String) As Boolean
Dim bsuccess As Boolean
Dim command As New SqlCommand("SELECT (Username,Password) from UserInfo WHERE Username = '" & txtusername.Text & "'", connection)
Try
Dim drdUsers As SqlDataReader
drdUsers = command.ExecuteReader
connection.Open()
While drdUsers.Read
If txtpassword.Text = drdUsers.Item("Password") Then bsuccess = True
End While
connection.Close()
Catch
bsuccess = False
connection.Close()
End Try
Return bsuccess
End Function
|
|
|
|
|
Firstly you should post this in vb Forum,
Secondly your Code is messy, it seems you dont know where to put your code. You are Executing the command outside your connection. Open the Connection and Execute your command and Close the Connection and Close the reader and after that you dont need to loop through the reader. Here is my Suggestion, why dont you use a StoredProcedure that returns number of rows ,and when you call that Stored Procedure you will test for records that are returned. if you planned it well you will be looking for an integer that is "1" or less than one , e.g
if(intTeturned < 1)
{
}
else
{
}
}
Hope this Helps
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
Hi,
I created a kind of employees application with all sorts of data. I working with SQL server and C#.
I have most string and int data, but also some images.
But i use the "string-with-path-method" to get to the images.
It works ok, but since the images are in a folder, it seems that they are not as private like the other data.
I dont know how to work with the images in SQL server, so i use that method.
Can anyone help me here?
Thanks
|
|
|
|
|
|
|
Hi,
I design a windows application that needs to pull data from a SQL server database.
It works just fine!!!.
But, when i install the application in another computer i get problems,I need to attach the database in SQL server in order to work.
So, i want to get a nice "connection string" to pull data from the database without no further "attachments"!
Can anyone help me?
(I usually use *.udl files to see the connection-string)
Thanks
modified on Wednesday, July 2, 2008 9:29 PM
|
|
|
|
|
Please do ODBC Connctivity. did you know any thing about that?
You should first define a ODBC connectivity in your Projects. After that first you establish ODBC Connection in your client system, after install your exe in the particular system, it will work definately.
|
|
|
|
|
ODBC will require that you establish an ODBC connection from the client - therefore you need to manage the client as well as your app.
I suggest this site
clickety[^]
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Any idea how to create an SID for the oracle instant client??
Many thanks
All generalizations are wrong, including this one!
(\ /)
(O.o)
(><)
|
|
|
|
|
|
|
HI,
i am dealing with a database, which is having billions of data. To improve the performance have introduced threads( thread pool c#). Also implemented locks to avoid conflict. But unfortunately that didnt improved the performance.
I did the same without lock now i got 25% improvement...
Tell me an idea to achieve performance without conflict
My small attempt...
|
|
|
|
|
Is the database normalized? Have you checked queries with query analyzer for bottlenecks? Those would be the first things I'd look at.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
the database is normalized.... doing indexing every weekend...
will check the queries to find bottlenecks...
do you have anyidea what happened to my threading ?
My small attempt...
|
|
|
|
|
sujithkumarsl wrote: Also implemented locks to avoid conflict. But unfortunately that didn't improved the performance.
How you did it ? Please post sample code so we can check what happened with your threading.
|
|
|
|
|
hi,
check this...
WaitHandle[] resetEvents = new WaitHandle[GeCommonConfig.ThreadCount];
for (int index = 0; index < GeCommonConfig.ThreadCount; index++)
{
resetEvents[index] = new AutoResetEvent(false);
ThreadDetails objThreaddetails = new ThreadDetails((AutoResetEvent)resetEvents[index], index.ToString());
ThreadPool.QueueUserWorkItem(new WaitCallback(StartProcessing), objThreaddetails);
}
WaitHandle.WaitAll(resetEvents);
Here StartProcessing is the method.... in which 80 datatables have been updating...among some are having billions of data...
protected static bool ExecuteQuery(string strQuery, DataSet dataSet, Object lockObject)
{
try
{
lock (lockObject)
{
return ExecuteQueryEx(strQuery, dataSet);
}
}
catch
{
}
return false;
}
I have a LockType class in which defined 5 differnt lock objects. according to the query( which all tables are using) the lock is passing to the ExecuteQuery method..
My small attempt...
|
|
|
|
|
sujithkumarsl wrote: WaitHandle.WaitAll(resetEvents);
This blocks the caller thread till all threads you queued finished executing. If it blocks, I don't see the benefit of using threading here. Your design is confusing. Can you post sample of the "StartProcessing" method ? Are you on a stand alone application or a web application ?
|
|
|
|
|
WaitHandle.WaitAll(resetEvents); just make sure that all threads completed.... main thread will wait there no problem..
here Startprocessing will do all the Database operations ( will run in different threads)
its windows application..
startProcessing()
{
Heavy Databse operations are doing here ( including insert, delete, select, update)
executeQuery();
}
My small attempt...
|
|
|
|
|
Are your clustered indexes being used?
Usually having the correct clustered indexes help a lot, but if they are build wrong for the tables, then your going to have overhead (long query times, more space being taken up).
If your using SQL Server, then the "Estimated Execution Plan" in the SQL Management Stuido can help a lot with seeing the steps of the queries and what operations are taking the longest to complete.
|
|
|
|
|
a couple more ideas
Partitioning your data
Striping your tables across multiple disks
And of course index tuning
Then check your queries and the join/where clauses
Hire a DBA to do some performance tuning (if tables have "billions" of rows you need one)
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi i have tested the application in a better machine( 32 GB ram, 16 processors) with 8 threads and finally i got 355% improvements.
anyway i am planning to have a small database for all operations and end of the day i will deploy the values to the main database.. what you think
My small attempt...
|
|
|
|
|
I need help on creating a trigger for insert and update. My table looks like this:
tblCandidates
canID smallint PK identity
ID int FK
eleID smallint FK
What I need to do is: During insert or update, if there are two records with the same ID and eleID, operation should be aborted and to return some string as output (ex: "operation impossible")
Thank you
|
|
|
|
|
Why not include eleID in primary key?
Giorgi Dalakishvili
#region signature
my articles
#endregion
|
|
|
|
|
I don't think a trigger works like that. As I never use triggers this is conjecture
Insert/Update causes trigger to execute, the trigger is a seperate stored procedure and cannot affect the outcome of whatever causes the insert/update.
However:
You really should put this check in the initial method, otherwise you are programming by error. IE try something if there is an error then it is wrong ahh do something else.
Never underestimate the power of human stupidity
RAH
|
|
|
|