|
alter your current connection string to point to the remote SQL Server IE:
User id=YOURUSERNAME; password=YOURUSERsPASSWORD; Data Source=YOURREMOTESQLSERVER; Initial Catalog=YOURDATABASENAME;
Hope this is helpful.
|
|
|
|
|
User id=username; password=userpassword; Data Source=120.120.120.120; Initial Catalog=dbName;
Data Source=IP Address where your database is located.
i thing it is use full for you...!
Pavan Pareta
|
|
|
|
|
this statement wont work
imports microsoft.office.core.commandbar
which dll should i import??
"You can do any thing you set to your mind" - theGhost_k8
|
|
|
|
|
Office.dll
---
b { font-weight: normal; }
|
|
|
|
|
i'm not getting microsoft.office.core.commandbar class in office.dll
i've got .commandbarclass there but .commandbar is not there.
again adding ref. to office causes me ambiguty with Microsoft.Office.Core in commanbar etc objects.
"You can do any thing you set to your mind" - theGhost_k8
|
|
|
|
|
|
hi guys
iam new to windows forms, iam a web developer.
Can i ask for a function that copies employees from one list box to another when pressing on a button.
where display memeber is empName and value =id
any help?
thanks
|
|
|
|
|
Are you wanting to move the entire list of names to the listbox or only selected names?
|
|
|
|
|
Actually i want to do both. I want to move only selected items first then to have an option like a check box or so to be able to move all. Thanks in advance.
|
|
|
|
|
Hi everybody !
I'm programming control interfaces using a PocketPC running under Windows Mobile 5, and I use VB.NET.
I'm trying for a while to create my own control component (actually it's should be a speedometer), but I'd like to NOT refresh all the control when I change the value it should displays
I explain myself :
I've got what I call a background : a line, an ellipse, a filled ellipse and a fille rectangle
I've got a needle (to display the speed) : an array of points connected by a polygon and a filled polygon
What I'd like to do is to refresh only the needle, not the background (because it blink because of the powerlessness and the speedlessness of the PocketPC)
I found on this site that I have to override the "OnCreateControl " sub, but it does'nt exist ! (so I can't override it)
Thank you for your help
Regards,
Ch'Portos.
Yop Yop !!
|
|
|
|
|
You should have asked this in the Mobile Development[^] forum. The .NET Compact framework doesn't support everything it's desktop cousin does.
I don't do mobile dev so I have no idea if this is supported. But, in the desktop world, you set up your ConstrolStyles, turning on DoubleBuffering and handling all the painting yourself:
Public Class MyControl
Public Sub New
SetStyle(ControlStyles.AllPaintingInWmPaint, True)
SetStyle(ControlStyles.OptimizedDoubleBuffer, True)
SetStyle(ControlStyles.UserPaint, True)
End Sub
Then you override OnPaint where you do all of your painting. This should eliminate the flicker.
Another method would be to just paint your entire control to an offsreen Bitmap, then just copy the bitmap to the drawing surface in your OnPaint:
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
Dim backBuffer As New Bitmap(Me.ClientRectangle.Width, Me.ClientRectangle.Height)
Dim bg As Graphics = Graphics.FromImage(backBuffer)
' Do all your control painting here
bg.draw...this and that
bg.Dispose()
' Now draw your buffered image to your control surface
Dim g As Graphics = e.Graphics
g.DrawImage(backBuffer, 0, 0, backBuffer.Width, backBuffer.Height)
End Sub
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Thanks to the help from yesterday i have managed to get thus far, just one stumbling block left if any one can help
Code from login
Protected Sub Login1_Authenticate(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.AuthenticateEventArgs) Handles Login1.Authenticate
Dim mydataSet As New DataSet
Using connection As New SqlConnection("Data Source=TESTSQL;Initial Catalog=DevDataBase;Integrated Security=True")
Dim adapter As New SqlDataAdapter()
adapter.SelectCommand = New SqlCommand("Select Count(*) from DevDataBase.dbo.Operators where Name = '" & logon1.UserName & "' and Psw = '" & logon1.Password & "'", connection)
adapter.Fill(mydataSet)
MsgBox(mydataSet.Tables(0).Rows(0)(0))
End Using
End Sub
If the user name and password are correct then I get a count of 1. How would this work with a stored procedure
Stored Procedure Name is 'OpersLogon' and the parameters supplied are
@OperatorName varchar(20),
@OperatorPassword varchar(20),
@ReturnValue Int Output
I really do need help..... all this computer stuff is way over my head !!
|
|
|
|
|
Dim sqlConn As SqlClient.SqlConnection<br />
Dim command As SqlClient.SqlCommand<br />
Dim adapter As SqlClient.SqlDataAdapter<br />
Dim table As DataTable<br />
<br />
Try<br />
sqlConn = New SqlClient.SqlConnection("YOUR CONNECTION STRING")<br />
command = New SqlClient.SqlCommand("OpersLogon", sqlConn)<br />
With command<br />
.Parameters.AddWithValue("@OperatorName", Server.HtmlEncode(logon1.UserName))<br />
.Parameters.AddWithValue("@OperatorPassword", Server.HtmlEncode(logon1.Password))<br />
.CommandType = CommandType.StoredProcedure<br />
End With<br />
adapter = New SqlClient.SqlDataAdapter(command)<br />
table = New DataTable<br />
adapter.Fill(table)<br />
If CInt(table.Rows(0)(0)) <> 1 Then Throw New ApplicationException("Invalid User Credentials.")<br />
Catch ex As Exception<br />
' Report or document the exception<br />
Finally<br />
If sqlConn.State <> ConnectionState.Closed Then sqlConn.Close()<br />
End Try
Might not be the most efficaint code but I've been using it on a site for the past year and a-half with no troubles.
|
|
|
|
|
That will work a treat,
Its very similar to what i use in a standered VB6 application, just didnt think it would work on this for some reason. Thats the great thing about this site, theres always something more to learn
Thanks again
I really do need help..... all this computer stuff is way over my head !!
|
|
|
|
|
AreJay,
seems like ive hit a small problem, what happens if the stored proc returns a integer , ie in the stored procedure its returning an int as an output parameter;
in the stopred proc @ReturnValue INT OUTPUT
I really do need help..... all this computer stuff is way over my head !!
|
|
|
|
|
Pete Newman wrote: @ReturnValue INT OUTPUT
table = New DataTable<br />
adapter.Fill(table)<br />
If CInt(table.Rows(0)(0)) <> 1 Then
The output is being returned into the datatable then tested with table.Rows(0)(0). I understand that the stored proc may have a param of @ReturnValue INT OUTPUT, is this stopping the proc from running because your not assigning an output variable? I don't use an output param with my stored procs, I'll need to test the code I've posted and get back to you.
|
|
|
|
|
cheers AreJay
i know there has to be a way... but well its beyond me
I really do need help..... all this computer stuff is way over my head !!
|
|
|
|
|
Hi,
I have some problems with:
Dim oType As System.Type = oDAOModel.GetType
Dim oPropertyInfo As Reflection.PropertyInfo = oType.GetProperty("connected")
Dim oObjectAux As Object = oPropertyInfo.GetValue(oDAOModel, Nothing)
When the propety connected (Boolean type) is nothing, "If oObjectAux is Nothing Then" says that oObjectAux not is nothing, but "If CType(oObjectAux, Boolean) is Nothing Then" works fine.
How I can check if properties are Nothing dinamically (without knowing property type)?
Thanks,
Mario
|
|
|
|
|
I can't understand what you're trying to do with this...
But, if your cast an Object to a value type, is will never be Nothing. I don't get what you're trying to do with this???
amapumu wrote: How I can check if properties are Nothing dinamically (without knowing property type)?
You can't. Value types are never Nothing.
What is this code supposed to be doing? Why are you doing it this way?
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I'm trying to know, using reflection, what properties of any object contains a Nothing value.
I want to obtain a message like:
"Object X, Property prop1 is Nothing, Property Prop2 not is Nothing..."
"Object Y, Property AnyProp1 is Nothing, Property AnyProp2 not is Nothing..."
....
|
|
|
|
|
Connected will return True or False, never Nothing. "Nothing" is not a value. It's a reference, or the lack of a reference to an object. Nothing means "this variable doesn't point to an instance of anything". So,
When the propety "connected" (Boolean type) is nothing...
will NEVER happen. Value types, like Integers and Booleans, will ALWAYS return a value, not a reference.
This is something I whipped up real quick. It's got some serious limitations and drawbacks, but it should give you the idea:
Private Function IsNull(ByRef obj As Object, ByVal prop As String) As Boolean
Dim memberInfos() As MemberInfo = obj.GetType().GetMember(prop, BindingFlags.Instance Or BindingFlags.Public)
If memberInfos.Length > 0 Then
For Each mi As MemberInfo In memberInfos
Debug.WriteLine(String.Format("Object Declaring Type: {0}", mi.DeclaringType.ToString()))
Debug.WriteLine(String.Format("Object Reflected Type: {0}", mi.ReflectedType.ToString()))
Debug.WriteLine(String.Format(" {0} is a {1}", mi.Name, mi.MemberType.ToString()))
Select Case mi.MemberType
Case MemberTypes.Property
Dim pi As PropertyInfo = obj.GetType().GetProperty(prop)
Dim v As Object = Nothing
v = pi.GetValue(obj, Nothing)
Debug.WriteLine(String.Format(" Value: {0} ({1})", v, pi.PropertyType().ToString()))
If v Is Nothing Then
Return True
Else
Return False
End If
End Select
Next
Else
Throw New InvalidArgumentException("Property name not found!")
End If
End Function
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi,
I'd like to know how to save an image from a picturebox to a file. In Visual Basic 6 there was a very simple option: image.save(Filename, extension) or something like that but how can i save an image in VB.NET?
Thanks, Zaegra
--Zaegra--
|
|
|
|
|
This will only work depending on how you've drawn your image, but....
PictureBox1.Image.Save(filepath)
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Jups that worked thanks Dave
--Zaegra--
|
|
|
|
|
Hi this is Tracy here.
I'm doing a form created from Visual Studio 2005 which contain a "Add" button and a DataGridView. If the records are successfully added, it will be inserted into the SQL server database. I am trying to insert records into my SQL Server database without retrieving any information first.
But my program can't work and I don't know where it had gone wrong.
Here listed my codes when the user click on the "Add" button for the DataGridView:
'Add Button For DataGridView
Dim sqlcom As SqlCommand = New SqlCommand()
Dim mySqlDataAdapter As SqlDataAdapter
mySqlDataAdapter = New SqlDataAdapter
Dim myDataSet AsNew DataSet()
Dim mySqlcb As SqlCommandBuilder
mySqlcb = New SqlCommandBuilder(mySqlDataAdapter)
mySqlDataAdapter.InsertCommand = mySqlcb.GetInsertCommand
mySqlDataAdapter.Update("TBReqDG") 'ERROR COMES FROM HERE
'Open connection, execute the commands
sqlcon.Open()
'Close Connection
sqlcon.Close()
But there is still an error as shown below:
Error 1 Overload resolution failed because no accessible 'Update' can be called with these arguments:
'Public Function Update(dataTable As System.Data.DataTable) As Integer': Value of type 'String' cannot be converted to 'System.Data.DataTable'.
'Public Function Update(dataRows() As System.Data.DataRow) As Integer': Value of type 'String' cannot be converted to '1-dimensional array of System.Data.DataRow'.
'Public Overrides Function Update(dataSet As System.Data.DataSet) As Integer': Value of type 'String' cannot be converted to 'System.Data.DataSet'. C:\Documents and Settings\Administrator\Desktop\CCC\OfasERP_New PartII\OfasERP\frmRequisitionVoucher.vb 246 9 OfasERP
Hope to receive reply soon as it's urgent & thanks
Regards
Tracy
|
|
|
|