|
the error is this :
A connection was successfully established with the server, but then an error occurred during the login process. (provider: Shared Memory Provider, error: 0 - No process is on the other end of the pipe.)
its stuck when its come to Myconn.open().
whats wrong with this code?
conMyData = New SqlConnection(ConfigurationManager.AppSettings("psmConnectionString"))
cmdSelect = New SqlCommand("sp_ValidateUser", conMyData)
cmdSelect.CommandType = CommandType.StoredProcedure
parmReturnValue = cmdSelect.Parameters.Add("RETURN_VALUE", SqlDbType.Int)
parmReturnValue.Direction = ParameterDirection.Input
cmdSelect.Parameters.Add("@noPekerja", SqlDbType.VarChar)
cmdSelect.Parameters.Add("@pWord", SqlDbType.VarChar)
conMyData.Open()
cmdSelect.ExecuteNonQuery()
intResult = cmdSelect.Parameters("RETURN_VALUE").Value
conMyData.Close()
|
|
|
|
|
|
i enable the pipe name protocols but there is a new error.
A transport-level error has occurred when sending the request to the server. (provider: Shared Memory Provider, error: 0 - No process is on the other end of the pipe.)
could u check my code pliz :
conMyData = New SqlConnection(ConfigurationManager.AppSettings("psmConnectionString"))
cmdSelect = New SqlCommand("sp_ValidateUser", conMyData)
cmdSelect.CommandType = CommandType.StoredProcedure
parmReturnValue = cmdSelect.Parameters.Add("RETURN_VALUE", SqlDbType.Int)
parmReturnValue.Direction = ParameterDirection.Input
cmdSelect.Parameters.Add("@noPekerja", SqlDbType.VarChar)
cmdSelect.Parameters.Add("@pWord", SqlDbType.VarChar)
conMyData.Open()
cmdSelect.ExecuteNonQuery()
intResult = cmdSelect.Parameters("RETURN_VALUE").Value
conMyData.Close()
If intResult < 0 Then
If intResult = -1 Then
lblMessage.Text = "Username Not Registered!"
Else
lblMessage.Text = "Invalid Password!"
End If
End If
|
|
|
|
|
There's nothing wrong with the code. Your connection string is either messed up, or you still have configuration issues with your SQL Server.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hello,,,
please can you help me about this problem cause i dont know how to save an image into the sql database and how i'm going to code for it....i'm a novice programmer and i'm eager to learn about it can please help me to solve this problem..please...
thanks
|
|
|
|
|
'This code can b used to store image in database using VB 6.0
Private Sub StoreImage(sPath As String)<br />
Dim bytBLOB() As Byte<br />
Dim intNum As Integer<br />
Dim rs as new RecordSet<br />
<br />
If (Trim(sPath) <> "") Then<br />
rs.Open "Select * From tTable1",cn,,adOpenDynamic,adLockOptimistic<br />
'Start store pic<br />
intNum = FreeFile<br />
Open sPath For Binary As #intNum<br />
ReDim bytBLOB(FileLen(Trim(sPath)))<br />
Get #intNum, , bytBLOB<br />
Close #1<br />
'End store pic<br />
rs.AddNew<br />
rs("Img").AppendChunk bytBLOB<br />
'Other Fields...."<br />
rs.Update<br />
End If<br />
End Sub<br />
<br />
Regards,
Javed
|
|
|
|
|
is it able to store the image file to a txt file? or dat file?
|
|
|
|
|
Private Sub SaveImageToSql()
'Try this example.
'This is not the best way but if you have no other way, try it.
'*********************************************
'You must StoredProcedure like this
'@Image image
'"INSERT INTO Table ([Image]) VALUES (@Image)"
'*********************************************
Dim connStr As String = "Connection String" ' Set Your Connection String
Dim filePath As String = "C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Sunset.jpg" ' Set Your Image File Path
Dim fs As IO.FileStream = New IO.FileStream(filePath, IO.FileMode.Open, IO.FileAccess.Read)
Dim br As New IO.BinaryReader(fs)
Dim bytes() As Byte = br.ReadBytes(fs.Length)
Dim sqlImg As New SqlTypes.SqlBinary(bytes)
Dim conn As New SqlClient.SqlConnection(connStr)
Dim cmd As New SqlClient.SqlCommand("StoredProcedureName", conn)
Try
Dim sqlP As New SqlClient.SqlParameter("@Image", SqlDbType.Image)
sqlP.Value = sqlImg
cmd.Parameters.Add(sqlP)
conn.Open()
cmd.ExecuteNonQuery()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
conn.Close()
conn.Dispose()
cmd.Dispose()
br.Close()
fs.Close()
br = Nothing
fs = Nothing
bytes = Nothing
End Try
End Sub
!alien!
|
|
|
|
|
VB.NET 2005 and SQL 2000
Does anyone know why when a column in my Db is tinyint, my datagrisview wont autoincrement it, and when it is integer, it is incremented as it should
I cant declare that column as autonumeric (datatable.columns(0).autonumeric=true) because it says a byte column cant be changed once it has data
Im having some problems with that and for now i had to change my table to int datatype instead of tinyint
It is weird because when i insert directly from sql analiser the tinyint auttonumeric does work
I hope someone can help me with this
Thank you
Alexei AR
Theres always a better way
Look for it
|
|
|
|
|
Why are you using a Byte type for an autonumber field??? It will only have 256 different values...
I don't think anyone's ever tried to use a TinyInt as an autonumber, well, maybe one. There's just no good use for it. What are you doing with this thing, anyway?
The workaround would be to inert a new, but blank, record in the database, then retrieve this new record and fill in whatever UI elements you need to with it. Let the database do the work for you.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-- modified at 7:18 Friday 24th February, 2006
|
|
|
|
|
256 is all i need, actually less, like 100
is just for a small catalog, i know i could use int but i wanted to use tinyint
Im using datatables an dataadapters to work with data,all data displayed on a datagridview. If it is autonumeric in my DB, then it cant be null, when i insert a new record in my datagridview, it raises a no null allowed arror, and to fix that i have to manually enter a number for the ID, I just would like it to autoincrement that column automatically, just like when it is integer
As i said, i tryied, datatable.columns(0).primarykey=true but it raises an error, since it wont let me change that property once the table has been filled
Thanks for your reply
Alexei AR
Theres always a better way
Look for it
|
|
|
|
|
AlexeiXX3 wrote: i know i could use int but i wanted to use tinyint
Why?? Isn't it just easier to go with what works instead of trying to shoehorn something in that puts up such a fight?
I think you might find this[^] useful.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I just can't seem to wrap my brain around this one. (Yes I'm a Newbei, lol) I just don't understand how to click on a list item and get it to do what I want.
I've got a listview control that shows "*.url" files and I'd like the user to click on the list item (*.url) and get it to open in the WebBrowser control that's on the same form. How would I go about doing that. I'm using VS.Net 2003.
|
|
|
|
|
In the SelectedIndexChanged event for the listview:
Me.WebBrowser1.Navigate(Me.lvwLeft.SelectedItems(0).SubItems(1).Text)
This is assuming the URL is in the second column of the listview.
If the URL is in the first column of the listview:
Me.WebBrowser1.Navigate(Me.lvwLeft.SelectedItems(0).Text)
Dean
|
|
|
|
|
Hello Dean,
Thank you for that code. It does work except it gives me the text of the item name as the navigating address which does not work. You have helped me though to realize that I must find a way to open the url file referrenced by that ListItem name in order to read it and then send the "http://" text within that file to the WebBrowser.Navigate. If you or anyone else can help me out to do this or maybe direct me in the right dirrection to figure it out, that would be great.
Thanks again for your help.
|
|
|
|
|
So what exactly is in the listview? Is it at list of URLS like this:
http://www.codeproject.com
http://www.msn.com
http://www.google.com
.
.
.
etc?
Or does the list contain the name of each website like this:
CodeProject
MSN
Google
.
.
.
etc?
Thanks,
Dean
|
|
|
|
|
It gets the name of the url files like this.
1sitename.url
2sitename.url
|
|
|
|
|
In that case, what I would do is put the actual URL navigation text in another hidden column of your listview and reference that text for the Navigate command.
So where the users see:
1sitename.url
2sitename.url
...listed in the first column of the listview, in the second column (with a column width of zero) would be the URL navigation text:
http://www.1sitename.com
http://www.2sitename.com
Then in the SelectedIndexChanged event you could do your navigate:
Me.WebBrowser1.Navigate(Me.lvwLeft.SelectedItems(0).SubItems(1).Text)
Dean
|
|
|
|
|
so each file in the directory I look through to populate the ListView I would need to open/read it and then put it's http address text in a hidden column in the Listview. That's what you mean right?
Question: If so, wouldn't that make things lag quite a bit if a person has many folders with possible 100's of links in it?
Thanks
-- modified at 17:56 Friday 24th February, 2006
|
|
|
|
|
Hey Dean,
I did what you suggested and it works very nicely and it doesn't lag at all. At least not with my Favorites folder and I have quite a few links in there. The only problem I have now is that I have only been able to read the complete url file text and there is too much garbage text to send it as a http: address. I have to find a way to extract only the url text and put that in the hidden column. Any ideas? Thanks
The text I get from the StreamReader is simular to this for every url file it reads, just the actual http:// text changes.
"[default]baseurl=http://www.adenak.com/[InternetShortcut]URL=http://www.adenak.com/Modified=1067F49A2E3BC50134"
Private Sub tvwExplorer_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles tvwExplorer.AfterSelect<br />
'Get reference to the selected node<br />
Dim dirInfo As DirectoryInfo = New DirectoryInfo(e.Node.FullPath)<br />
'Clear all the items in the listview<br />
lvwExplorer.Items.Clear()<br />
'Check if the Directory exist or not<br />
If (dirInfo.Exists) Then<br />
'Get reference to all the files<br />
Dim fileInfos As FileInfo() = dirInfo.GetFiles()<br />
'Add all the files to the ListView one by one<br />
Dim info As FileInfo<br />
For Each info In fileInfos<br />
'First check the extension, make sure it's a url file<br />
If info.Extension = ".url" Then<br />
Try<br />
'Open the file and read it<br />
'Convert the file path into a string for the StreamReader<br />
Dim infoPath As String = info.FullName<br />
' Create an instance of StreamReader to read from each file.<br />
Dim sr As StreamReader = New StreamReader(infoPath)<br />
'Read the complete url file text<br />
Dim url As String<br />
url = sr.ReadToEnd()<br />
'Extract only the url text<br />
<big>This is where I need to extract the http text</big><br />
<br />
Dim item As ListViewItem = New ListViewItem<br />
item = lvwExplorer.Items.Add(info.Name)<br />
' Link the ImageList object<br />
item.ImageIndex = 2<br />
'Add the items<br />
item.SubItems.Add(url.ToString())<br />
item.SubItems.Add(info.LastAccessTime.ToString())<br />
sr.Close()<br />
Catch ex As Exception<br />
'Ignor Exception<br />
Return<br />
End Try<br />
End If<br />
Next<br />
End If<br />
End Sub
-- modified at 19:43 Friday 24th February, 2006
|
|
|
|
|
Hey Dean,
I got it to work! Sorry but the Newbie is excited!!! lol I figured it out. I was reading the text wrong. I was reading the whole thing in one shot instead of reading it line by line and the 4th line I had to read it in two shots. This is the reading code I did and it all works just fine now. For anyone (Newbies) that need to know how to do this here's the extra code to finish it up. Change everything between the "Dim url As String" and the beginning of the listview code to this below.
'Read the url file and get the url text<br />
Dim c(3) As Char<br />
Dim url As String<br />
url = sr.ReadLine()<br />
url = sr.ReadLine()<br />
url = sr.ReadLine()<br />
url = sr.Read(c, 0, c.Length)<br />
url = sr.ReadLine()
Thanks again for all of your help Dean.
|
|
|
|
|
I have created a new instance of a form from a thread that responds to incoming UDP packets from another computer. This form shows up in the screen but the user cannot use it’s command buttons. Other threads cannot manipulate it’s variables or cause a paint event on it’s picture box.
How does one accomplish these things?
Thanks.
RCarey
|
|
|
|
|
Forms are not thread safe.
Because of this, I highly recommend that you display all of your forms on the same thread. If you need a separate thread to manipulate a form's contents, then look into using the BeginInvoke() method. See the below link for more details.
http://www.codeproject.com/csharp/begininvoke.asp[^]
|
|
|
|
|
I'm quite a vb.net beginner and I lost my library-card so I have to wait a month before I can get a book about this: How do I load a dll file into my vb.net program??
(I'm only 15 so I'm not very good at vb.net)
|
|
|
|
|
It depends what that dll file is! not all .dll files are the same thing, confusing I know!
So, if it is another dll written in .NET, then you just add a reference to the dll (are you using Visual Studio?)
If it is a COM dll, then you can still add a reference, and if using Visual Studio it will do the "hard work" for you.
If it is a windows dll then you often have to call them using pinvoke... this is a little complex if you are a beginner.... i hope its one of the above!
Hope that helps buddy, 15 is a good age to start learning to program!
|
|
|
|