|
Yes i do want a code to help me increment values of a primary key in a database so as not to get an error on duplicte data entry.And yes i do have a well running Google interface.Both simple and complex code will do as i advance.
I need you help.
|
|
|
|
|
OK - when you create your table, use the word IDENTITY on the primary key, and the database will fill that value for you, incrementing it automatically.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
How can i include any program(setup program ex. winamp) in Deployment of program, so both programs will be installed by setup the deployment
|
|
|
|
|
How are you deploying ? I tend to write a little C++ app to run my MSI, install .NET and any other drivers I may need.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
If I have understood you problem correctly, you should enter the following SQL command string:
"...WHERE ti.itemcode=" & i.itemcode & " and v.vendorid= " & i.vendorid & " and ..."
|
|
|
|
|
If you read the thread below, he's apparently tried that. I suspect he needs to post his code.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
There is no where clause in this code. A few nested selects, however, this query will be slow, I would expect.
This is a SQL statement, the problem appears to be in the code which adds a where clause, and uses your variables to do so. Where is this code ? Does it exist ? Where does this SQL come from, is it a stored proc ? You've not posted any VB code, does this SQL get generated in VB ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
OK - you told me you were writing code. You're not, you're using some sort of wizard.
We're back to the point where the only advice I can offer is to write your own data layer, in code. Hopefully, someone who uses the stuff you're choosing to use can offer some other advice.
Here's an example that uses a stored proc:
http://www.developersdex.com/gurus/code/479.asp[^]
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Yes, the right way to do data access is stored procs, which take parameters.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
campbells wrote: I have create the global variable for User option which suppose will refer to param1 and param2...
Is this VB6, or by global do you just mean a public variable on a class ? Either way, this is bad design, you should do better.
I would suggest the best thing to do is to write your own SQL code ( which also means you can put it in a data layer where it belongs ), then you won't be fighting a wizard.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
campbells wrote: but~sure i cant put it like that cause the data command SQL will not regonize wat it the cfrom and cto variable
If you're just creating SQL, remember you're creating a static string, it's not going to be parsed. You need to make sure you're passing in the VALUE of your variable, and not it's name
s = s & " where bizdate<=" & cfrom & " and bizdate >= " & cto
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
OK - it's VB6 ? No, I would attack anyone who tried to put that on my machine
Like I said, sounds like your playing with wizard generated stuff, this never happens to me when I deal with databases entirely in code, and the other bonus is, I get to have a proper data layer.
I don't know what the Microsoft data environment is, but it sounds hideous. Hopefully, someone else knows more and can give you more specific help for the approach you're taking.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hello all,
Perhaps you can help me. I have a com object which I converted from VB6 to VB.NET. I am using this com object with other .Net applications without any problem. However, I am now trying to use this com object in some old ASP code which I have not yet converted. I want to use the com object because it contains some additional functionallity that the original com object did not possess. The ASP code works fine when calling the old com object. BUT..if I change the code to call the new com object, it takes a very very (60secs.) long time for the object to be instantuated. In other words, when the code hits the CreateObject line, it takes 60 secs to execute. The rest of the calls to the methods of that com object execute normally. What am I doing wrong? I am including code snipplets of both the VB.NET com object and the ASP page.
Thank you in advance.
Michael Gisonda
VB.NET---------------------
Option Strict Off
Option Explicit On
Imports System.EnterpriseServices
Imports System.Reflection
Imports System.Runtime.InteropServices
<assembly: assemblyversion("3.0.0.0")="">
<assembly: comcompatibleversionattribute(1,="" 0,="" 0)="">
<assembly: applicationname("estsyspro_net")="">
<assembly: assemblykeyfileattribute("n:\projects\estimpact.net\bin\estsyspro.snk")="">
<system.runtime.interopservices.progid("estsyspro_net.custinfo")> Public Class Custinfo
Inherits ServicedComponent
Private gImpConn As ADODB.Connection
Private mConnection As Object
<autocomplete()> Public Function GetBlanketContractInfo(ByVal contract As String, ByVal stockcode As String, Optional ByVal companyid As String = "L") As ADODB.Recordset
Dim sSQL As String
Dim rsRetRecord As New ADODB.Recordset
Dim rsGetRec As New ADODB.Recordset
Dim lLocalConnection As New ADODB.Connection
'Take the company id provided by the user and make it capitalized and only the first letter.
companyid = UCase(Trim(Mid(companyid, 1, 1)))
'Set the connection string to the proper company based on the companyid
lLocalConnection.ConnectionString = fnGetConnectionString(companyid)
'Open the connection.
lLocalConnection.Open()
sSQL = "SELECT SorContractPrice.ContractType, SorContractPrice.StockCode, " & "SorContractPrice.Contract, SorContractPrice.StartDate, " & "SorContractPrice.ExpiryDate, SorContractPrice.PriceMethod," & "SorContractPrice.FixedUom, SorContractPrice.FixedPriceCode, " & "SorContractPrice.FixedPrice " & "FROM SorContractPrice " & "WHERE SorContractPrice.Contract= '" & contract & "' " & "AND SorContractPrice.StockCode= '" & stockcode & "'"
rsGetRec = lLocalConnection.Execute(sSQL)
If Not rsGetRec.BOF And Not rsGetRec.EOF Then
rsRetRecord = MakeRS(rsGetRec)
OpenAndFillRS(rsGetRec, rsRetRecord)
Else
rsRetRecord = Nothing
End If
'Clean up
rsGetRec.Close()
rsGetRec = Nothing
lLocalConnection.Close()
lLocalConnection = Nothing
GetBlanketContractInfo = rsRetRecord
End Function
End Class
END VB.NET -----------------------------------------
ASP Code -------------------------------------------
if mcountrycd="001" then
mCountryLbl="L"
else
mCountryLbl="M"
end if
'vvv This line takes 60 secs to execute.
Set IMPC = server.createobject("EstSyspro_NET.CustInfo")
'vvv This line executes normally.
Set IMPCUST = IMPC.GetBlanketCustInfo(Trim(mSysproCustomer),mCountryLbl)
if IMPCUST is nothing then
......
.....
End ASP Code ---------------------------------------
|
|
|
|
|
Really, I don't think you're doing anything wrong, but I'm no expert on ASP. It seems that on that GetObject statement, the NET Framework has to loaded into the ASP process on the server. This can take quite a long time. Depending on the machine config, I've seen .NET 2.0 load times take about 30 seconds, so this could be part of your problem.
After the page successfully loads and gets through this code, try refreshing it or open a new browser window and load the same page. If the second browser window gets through the page quickly (or as expected), this is probably your problem, but unfortunately, I think you're stuck with it.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I have tried that, unfortunitely I get the same result.
Mike
|
|
|
|
|
Is there a way I can change only the font size of the contents in a Rich Text box? I've tried using
MainTxt.Font = New Font(MainTxt.Font.Name, 12) but that still removes any bold, italics, etc.
Any thoughts would be greatly appreciated.
Thanks for your time,
Brian
|
|
|
|
|
If you go in to the design view of the form and go in to the property of the rich text box. You can set the font size under Font property. Or you can set the font size in the load method of that form. by:
RichTextBox1.Font = New Font(RichTextBox1.Font.Name, 5)
---------------------------------
There is life outside coding.
|
|
|
|
|
The problem with that is the contents of the Rich Text Box, an rtf file, is loaded and reloaded several times throughout the program.
|
|
|
|
|
Maybe you can first select all the text, and then change the selectionfont.
'Dunno if this works:
'select all text
rtb.SelectionText = rtb.Text
'change font (only size so use old font)
'i don't know what happens if there are different fonts involved in the selection..
rtb.SelectionFont = New Font(rtb.SelectionFont, 12.0!)
'deselect the text
rtb.SelectionLength = 0
You could also look at the RichTextBoxExtended article.
"..Commit yourself to quality from day one..it's better to do nothing at all than to do something badly.."
-- Mark McCormick || Fold With Us! || Pensieve || VG.Net ||
|
|
|
|
|
Same thing, lost the bold and styles.
|
|
|
|
|
Using just the standard RTB control, you'll have to go through each part of the text and see if the font changes from the previous font style. Say you have a length of text and only the middle 1/3 of the text is in a different style. You'd have to do 3 font changes. Select the first part of the text, change it's font size by creating a new font using the name and styles of the existing font. Then find the next section of text based on its Font, change it's font, then find the last section of text and do the same.
Not very efficient, huh? Your only alternative is to replace the RTB with an extended version of the control that offers, well, more control over the editing capability of the text.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Crap.
You could do it one char at a time, but i think it's going to be slooooooow.
I'm going to bed now, good luck with it
"..Commit yourself to quality from day one..it's better to do nothing at all than to do something badly.."
-- Mark McCormick || Fold With Us! || Pensieve || VG.Net ||
|
|
|
|
|
Yeah it is!!
The way to do it, without the RTB is to represent the Text and formatting in a data structure behind the scenes, then render the visible version using that data. It then makes changing the font, or pieces of it, in sections very easy since you're not hunting for the changes in the font through out the text. The code would already know where to make the changes.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Now how would this translate into some hard code?
|
|
|
|
|
I haven't written anything like that. I just have a couple theories in my head about how I would approach the problem.
Storing the text seperate from the formatting gives you quick access to the formatting itself. Pointers between text segments and existing formatting objects in a collection would allow for reuse of the same formatting object to control the formatting of several segments of text.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|