|
Hi all,
I am working in vb.net and i am using sql server as back end which is stored on the server.
Client can access the database using his user id and password,
but the problem is that with the same login account the user can login from more than one client machine.
:-OI want that if the client has logined using suppose user id A and password A
then he will be not able to login again using the same user id and password from another client machine.
So how can it possible? will i have to maintain session like Asp.net ?
if yes then how can i maintain session using vb.net
Any idea would be appriciated heartly
Thanks with anticipation
|
|
|
|
|
Add a field to your user account table that indicates whether the user is currently logged on.
If a user is logging in and the value in this field is false, set it to true.
If a user is logging in and the value in this field is true, disallow the login.
When the user logs out, set the value in this field back to false.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
hello,
my name is sai kishore.Im working on a application which will ask the user for the backup,if he wish to take a backup,it must allow.im doing this application in vb.net 2005.
im unable to get the code for this.please help me,
my code is as follows
Private Sub cmdYes_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdYes.Click
'Dim ProcessId As Integer
Dim ProcessId As Object
Dim hProcess As Integer
Dim ExitCode As Integer
Dim LogFileName As String
Dim Process_handle As Integer
Dim path As String
'Dim vntretval As Variant
On Error GoTo localerror
'Check for User Name
'To check Export File Name.
If txtflname.Text = "" Then
MsgBox("Enter Export File Name.", MsgBoxStyle.Information)
Exit Sub
End If
'UPGRADE_WARNING: Screen property Screen.MousePointer has a new behavior. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6BA9B8D2-2A32-4B6E-8D36-44949974A5B4"'
'System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor
System.Windows.Forms.Cursor.Current = Cursors.Default
path = dirExp.Path
'checks if any file name is entered
'calls the procedure Conn_user;it returns true if connection
'is established
Dim strPwd As String = ""
Dim Usname As String = ""
Dim Uspass As String = ""
Dim strcopy As String = ""
SystemParameters()
If OptData.Checked = True Then
Usname = strsuperuser
Uspass = strSupreUserPassword
ElseIf OptPhoto.Checked = True Then
Usname = strPhotouser
Uspass = strPhotoUserPwd
End If
'ProcessId = Shell(resbckdls.Fields("BACKUP_NAME").Value & " " & Usname & "/" & Uspass & "@" & strUserConnect & " File = '" & lblPath.Text & "' log='" & Mid(lblPath.Text, 1, InStr(1, lblPath.Text, ".") - 1) & ".log'", AppWinStyle.Hide)
ProcessId = Shell("Exp" & " " & Usname & "/" & Uspass & "@" & strUserConnect & " File = '" & lblPath.Text & "' log='" & Mid(lblPath.Text, 1, InStr(1, lblPath.Text, ".") - 1) & ".log'", AppWinStyle.Hide)
hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, False, ProcessId)
Timer1.Enabled = True
Timer1.Interval = 100
Picture1.Visible = True
'anmExport.Open App.Path & "\FILECOPY.AVI"
'anmExport.Play
'anmExport.Visible = True
Do
Call GetExitCodeProcess(hProcess, ExitCode)
System.Windows.Forms.Application.DoEvents()
Loop While (ExitCode = STILL_ACTIVE)
Call CloseHandle(hProcess)
'UPGRADE_WARNING: Screen property Screen.MousePointer has a new behavior. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6BA9B8D2-2A32-4B6E-8D36-44949974A5B4"'
'System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default
System.Windows.Forms.Cursor.Current = Cursors.Default
'anmExport.Stop
'anmExport.Visible = False
Dim blnExportTerminatedsuccessfully As Boolean
Dim blnViewsExported As Boolean
Dim blnStoredProceduresExported As Boolean
Dim blnFileSize As Boolean
LogFileName = Mid(lblPath.Text, 1, InStr(1, lblPath.Text, ".") - 1) & ".log"
FileOpen(1, Mid(lblPath.Text, 1, InStr(1, lblPath.Text, ".") - 1) & ".log", OpenMode.Input)
Do While Not EOF(1)
Input(1, strline)
'UPGRADE_WARNING: Couldn't resolve default property of object strline. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
If strline = "Export terminated successfully without warnings." Then
blnExportTerminatedsuccessfully = True
'UPGRADE_WARNING: Couldn't resolve default property of object strline. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
ElseIf strline = ". exporting views" Then
blnViewsExported = True
'UPGRADE_WARNING: Couldn't resolve default property of object strline. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="6A50421D-15FE-4896-8A1B-2EC21E9037B2"'
ElseIf strline = ". exporting stored procedures" Then
blnStoredProceduresExported = True
End If
Loop
FileClose(1)
k.v.s.s.kishore kumar
|
|
|
|
|
Hi,
I have an array declared as a structure. The structure has about 7 members (variables).
Is there a way to loop through the array and for each member check if it is null?
like this:
for i= 0 to array(index)
for each object array(index)
if is nothing ...
next
next
Thank you!
|
|
|
|
|
No.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
As Christian said it is not possible, but a handy method is to make a function called GetNulls() in your structure which returns null members. Now search through the array and get nulls.
|
|
|
|
|
Hi
I am using VB.2005 Express edition to develop a application. I can define my issue in parts
- What all Grid Controls are available. Is there only one “Data Grid View” grid control ?
- I wanted to use the grid control to display reports, this report is based on query from database, system state, user types and some more things. My issue is that i am not finding any way how to add data to Data Grid control. The only way i am finding is to link the column with some table. Cant i formulate a row on my own and add it in the grid.
- Is there any other control in which i can on my own formulate the data and display, the way we used to do in VB6 in MsFlexGrid or the Grid control
Regards
Nishkarsh
|
|
|
|
|
You create a DataSet and populate that with data from your database by using a DataApapter. You call the Fill method of the DataAdapter to get the data into the DataSet.
Now you can set the DataGridView.DataSource property to be a Table in your DataSet.
Dim ds As DataSet = New DataSet()
Dim cn As SqlConnection ... ' your connection string here.
cn.Open()
Dim cmd As New SqlCommand("SELECT * FROM TABLE",cn)
Dim da As New SqlDataAdapter(cmd)
da.Fill(ds,"tableName")
cn.Close()
Me.DGV.DataSource = ds.Tables("TableName")
The DataGridView is much more powerfull and usefull that the old MSFlexGrid (especially for bound data) and only takes a little patience to master.
Check for these terms in MSDN, Google or on Code Project for heaps of examples.
The Fanatical All Black Supporter - Kea Kaha
|
|
|
|
|
In this lotto project i am producing 6 nonrepeating random numberswith one procedure. when i call this to make 6 randomnumbers for 54 week it is giving the same numbers
the code is below
Sub randomNumbers(ByVal num As Integer)
Dim randomNum As New Random
Dim i As Integer
For i = 0 To num
rnd = randomNum.Next(1, 46)
If i = 0 Then
Numbers(i) = rnd
Else
For j As Integer = 0 To i - 1
If Numbers(j) = rnd Then
rnd = randomNum.Next(1, 46)
j = 0
Continue For
End If
Next
Numbers(i) = rnd
End If
Next
End Sub
Sub sorting()
Dim temp As Integer
For i As Integer = 0 To Numbers.Length - 2
For j As Integer = i + 1 To Numbers.Length - 1
If Numbers(j) < Numbers(i) Then
temp = Numbers(i)
Numbers(i) = Numbers(j)
Numbers(j) = temp
End If
Next
Next
End Sub
Private Sub bt56_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt56.Click
Dim i As Integer
'Dim num(5) As Integer
Dim ctr As Integer = 0
Me.Label1.Text = ""
For i = 1 To 54
Me.randomNumbers(5)
sorting()
For j As Integer = 0 To 5
fiftysixArray(ctr) = Numbers(j)
Numbers(j) = 0
ctr += 1
Next
Next
End Sub
|
|
|
|
|
Hi,
if you don't provide an explicit seed a random number generator will use the current time
as a seed, so everytime you create a new Random (within the same millisecond or so) it
will generate the same sequence.
Solution: insert a Thread.Sleep(1000) and/or provide a variable seed somehow
[added] or avoid creating new Randoms all the time (just have a single static one and
keep using it) [/added].
-- modified at 20:36 Friday 2nd November, 2007
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Thanks Luc Pattyn . I got it corrected. Thanks for your solution
|
|
|
|
|
I am building a cash register with one textbox showing the item, another the price and another the quantity of that item being purchased.
How can I get a line in a listbox to show the price, quantity and item purchased?
Also, with another list box just containing the totals of each item purchased, how can I get a grand total with 2 decimal places?
Thank you
|
|
|
|
|
1 - by adding an item to the listbo
2 - by using the overload of ToString that takes a format specifier.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Don't understand the response can you please give an example
Thanks
|
|
|
|
|
ListBox1.Items.Add(new ListBoxItem(theStringYouWantInTheListBox);
decimal theAmount = 3.345234;
string currency = theAmount.ToString("c");
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi, I need to inherit my Form2 to Form3, when i use 'Inherits Form2' my form3 doesnt show up and I get this error message and I cannot view my Form3 design at all!
<br />
Warning 1 The designer could not be shown for this file because none of the classes within it can be designed. The designer inspected the following classes in the file: <br />
<br />
Form3 --- The base class 'WindowsApplication1.Form2' could not be loaded. Ensure the assembly has been referenced and that all projects have been built. 0 0 <br />
All i want to do is use some text out of a textbox in form2 and display it in a label on form3
Many thanks, Brad
|
|
|
|
|
Brad,
Try this:
vb.net 2003:
declare an instance of Form2 in Form3
Dim newForm2 As New Form2
label.text = newForm2.textbox.Text
vb.net 2005:
no need to declare an instance of Form2 in Form3
label.text = Form2.textbox.Text
Hope this helps.
Ken
|
|
|
|
|
Much love x
Thanks man! (y)
|
|
|
|
|
Hi All
I am working on a project at present i have half of it done already in VB.net server side but i require to use another language platform to code the client side to consume the XML and display the XML doc. Can anybody explain what i should be looking for to get started on this.
This is a crossplatform web service Client/Server with 2 different languages for instance i have done LoanCalcService in VB.Net server side and created with the use of XML doc and now just require to consume XML, SOAP, WSDL etc with another language platform client side and display. Please
Thank You Beforehand
|
|
|
|
|
I am having a problem with a few Crystal Reports that I can’t seem to track down. It is the same problem so I am sure that once I get one fixed then I can fix the same problem with the other. I am working with VB.Net 2005 and working with the CR (10.2.3600.0) version that ships with it.
My report looks at a single table in my Dataset. When I add or edit items in the program and then run the report they show up just fine. But when I delete an item and then run the report it still shows the item I deleted. I have to close out of my program and reopen then run the report before that item is removed.
I have verified that I am Updating and Filling the Dataset before I run the report. I tried creating a whole new report but it has the same problem. Can anyone help me with this?
|
|
|
|
|
I am new to web development, and to this point I have learned everything from help pages and forums like this. I have viewed many posts on submitting forms, but none seem to cover my problem. All I want to do is have users enter in information, and click submit so an email will be sent to me with their information. Nothing fancy. I tried following a suggestion using an email template and a "sendmail.asp" file. I kept getting this error:
----------
[HttpException (0x80004005): The HTTP verb POST used to access path '/Website/sendmail_cdo.asp' is not allowed.]
System.Web.DefaultHttpHandler.BeginProcessRequest(HttpContext context, AsyncCallback callback, Object state) +464
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +166
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +146
----------
Can someone please help me out. I am in over my head on this one.
Thank you.
-Christian
|
|
|
|
|
You can't use an asp page in an ASP.NET site. However, you can send an email from ASP.NET, quite trivially. Did you try google ?
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi,
I need to send username,userid, and user email in an xml file. This xml file is wrapped in a cookie and what I need to do now is send this cookie using httpwebrequest to another website.
My code is as follows:
<br />
<br />
Dim webBrowser As HttpWebRequest<br />
Dim sXmlData As XmlDocument<br />
Dim sCookie As HttpCookie<br />
<br />
sXmlData = New XmlDocument()<br />
<br />
'writing data to an xml document<br />
With sXmlData<br />
.LoadXml(("<Xml><username>" + Me.UserInfo.Username + "</username><uid>" + Convert.ToString(Me.UserId) + "</uid><email>" + Me.UserInfo.Email + "</email></Xml>"))<br />
.Save("D:\\std.xml")<br />
End With<br />
<br />
<br />
'reading the xmldocument into a cookie<br />
sCookie = New HttpCookie("UserInfoCookie")<br />
With sCookie<br />
.Values.Add("UserInfoCookie", sXmlData.InnerXml)<br />
End With<br />
<br />
'sending the cookie using response but I want it through httpwebrequest<br />
' Response.Cookies.Add(sCookie)<br />
' Response.Redirect("http://www.abc.com")<br />
<br />
<br />
Try<br />
webBrowser = HttpWebRequest.Create("http://www.abc.com")<br />
<br />
With webBrowser <br />
.CookieContainer.Add(sCookie) 'this line is giving me an error<br />
End With<br />
<br />
Catch ex As Exception<br />
<br />
End Try<br />
<br />
<br />
thank you
|
|
|
|
|
OK, I love to learn new and better ways to do things, but this just doesn't seem one of them.
I'm originally from the Java camp so I've used straight DB code such as hard coded calls to the database and ORM tools like Hibernate. I've been working in VB for the past 5 years on various projects and have used similar techniques here as well.
I am working on a fairly large project and decided to use strongly typed db access such as what is taught in these fairly popular tutorials:
http://www.asp.net/learn/data-access/[^]
Boy am I getting a headache. It seems to me that the only benefits I get are IntelliSense and compile time checking. IntelliSense wasn't available before strongly typed database code so this is more of a convenience than any real need. Compile time checking is nice but I've already had several errors that are not caught until runtime. These errors largely deal with enforcing constraints when filling a DataTable using a standard DataAdapter. Most of these errors are extremely trivial, do not interfere with my actual code and would never have been brought to my attention without strongly typed db code.
So here is what I see as the major negative. I feel like I am getting much more code dependence rather than the current shift towards independence. This project largely works with data from a vendor database. If they ever update their schema (which can be as often as once a week) my app will break, even if they simply change a field from varchar(10) to varchar(12).
I'm starting to lean towards either rolling my own db code or using NHibernate again. Also, LINQ seems to be a departure from this strategy as well.
Does anyone else have any comments? Have any of you used strongly typed db code on a large project and found it to be indispensable? What am I missing?
Thanks!
Matt Penner
-- modified at 17:13 Tuesday 6th November, 2007
|
|
|
|
|
Hi to all,
I'm writing a code (in VB .net Compact Framework environment) to read a text file (where is included a field containing a DateTime in Ole Automation format i.e.: 39097.4010995 is equivalent to 1/15/07 9:37:34 AM ).
Before to adding the part of code relative to above work,the program (in fase of development yet), was working almost perfectly in both emulator (windows mobile 2003 SE) and the real device.
After I added the following code lines (only that relatives to DateTime elaboration):
----------------------------------------------------
Dim Tempi() As Single
Dim DatOra As DateTime
Dim Tempo As TimeSpan
Dim Tempo1 As DateTime
Dim Tempo2 As DateTime
Tempi = New Single(TotRecords) {}
DatOra = DateTime.FromOADate(Microsoft.VisualBasic.Mid(line, D1, D2))
If CountLines = 7 Then
Tempo1 = DatOra : Tempo2 = DatOra
Else
Tempo1 = Tempo2 : Tempo2 = DatOra
Tempo = Tempo2 - Tempo1
End If
Tempi(CountLines - 7) = Tempo.TotalSeconds
-------------------------------------------------------
the program is perfectly working only on emulator, but on real device, return me this error:
ArgumentException
Impossible to show an error message. It is not been found assembly of the optional resource that contain it.
in System.DateTime.DoubleDateToTicks()
in System.Windows.Forms.Form.WnProc()
in System.Windows.Forms.Control._InternalWnProc()
in Microsoft.AGL.Forms.EVL.EnterMainLoop()
My device is Windows mobile 2003 SE based, updated to Version 2.00 of Compact framework, and is Italian language Culture.
To develop code, I'm using English version of VS 2005 and Compact Framework environment.
Any idea on where is the problem?
May be that problem depends on different languages (I am not sure)? If yes can someone help me please?
Marco
|
|
|
|