|
Thanx!!!
|
|
|
|
|
long time did not come back...
for the sql injection issue..i'd suggest to use stored procudures instead of inline sql
<< >>
|
|
|
|
|
enjoycrack wrote: for the sql injection issue..i'd suggest to use stored procudures instead of inline sql
Yes,, also for better performance.
but in case you can't use stored procedures (because you make a dynamic query) you still can use a parameterized query.
|
|
|
|
|
Hello,
I am working on one web base portal and currently requirement is like that need to send SMS to any mobile around the world.
Can anybody help me regarding this.
URL or sample code will be helpful.
Thanks & Regards,
Kumar
|
|
|
|
|
|
there are two column names in my query to extract values.
and four rows corresponding to that query.
now i want to add both the values in the two dimensional array using redim peserve keywords.
i mean at run time i am increasing the length of the array.
i know the process in one dimensioal array.
how should i do that for two D?
-- modified at 8:01 Saturday 21st July, 2007
i am using the following code
Dim datearray(0,0) As String
Dim counter As Integer = 0
While (objDR.Read)
datearray(counter,0) = objDR.Item("wef").ToString
datearray(counter,1) = objDR.Item("abc").ToString
counter += 1
ReDim Preserve datecounter(counter, 0)
ReDim Preserve datecounter(counter, 1)
End While
Sonia Gupta
Soniagupta1@yahoo.co.in
Yahoo messengerId-soniagupta1
Love is Friendship and Friendship is Love....
|
|
|
|
|
This looks rather like a VB question than an ASP.NET question, as it has nothing at all to do with web development.
It's expensive to resize arrays. As it's not possible to actually resize an array, a new array is created every time, and all the data is copied from the old array to the new array.
Use a List of arrays, or a List of custom objects, instead of a two dimensional array.
Example in C#:
public class DemoClass {
private string _wef, _abc;
public DemoClass(string wef, string abc) {
_wef = wef;
_abc = abc;
}
public string Wef { get { return _wef; } }
public string Abc { get { return _abc; } }
}
List<DemoClass> items = new List<DemoClass>;
while (objDR.Read()) {
items.Add(new DemoClass(objDR.GetString("wef"), objDR.GetString("abc")));
}
foreach (DemoClass d in list) {
doSomethingWithTheData(d.Wef, d.Abc);
}
---
single minded; short sighted; long gone;
|
|
|
|
|
Hi,friends
i hav set allow paging property to true.
Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
cmd.Connection = cn
cmd.CommandText = "select * from EMP_DETAILS"
cn.Open()
grd.DataSource = cmd.ExecuteReader
grd.DataBind()
cn.Close()
End Sub
This is the error iam getting.
The data source does not support server-side data paging.
Suggest me to handle the error.
Thank u
|
|
|
|
|
you need to bind to a datatable, not a datareader
|
|
|
|
|
Use Datatable or Dataset instead of Datareader.
SSK.
|
|
|
|
|
Hi
I am tryin to display an image which is stored in a database
i ahve a procedure which will go to the appropiate record in my database and pull the file name from it
it should then take the file name and put it into a prefixed img src tag, which should then take the appropiate file from the imagestore and display to the web page
it all seems to work fine, even when i check the html source file the tag has been filled with the valid address but it jus doesn't seem to want to render the image
Is there anythin i need to do here? here is my code
<code> Sub getimage(ByVal sender As Object, ByVal e As EventArgs)
'Create connection string to pass database, string holds login information to mySQL,
Dim connectionString As String
connectionString = "Server=localhost; u;database=ftp1;"
'Builds .net mysql connection and passes connection string into method
Dim connection As New MySqlConnection(connectionString)
'Create mySql command string for passing query or SPROC(Stored Procedure)
Dim cmdString As New MySqlCommand
'Set Command to equal mySql connection,t so can pass SQL query
cmdString.Connection = connection
'Set command string to equal SPROC
cmdString.CommandText = "sp_getImage"
'ONLY PLACE THIS IF SPROC, sets the command to a SPROC
cmdString.CommandType = CommandType.StoredProcedure
Dim literr As New LiteralControl
Dim param As MySqlParameter
Try
'Creates parameter which will be passed into procedure
param = cmdString.Parameters.Add("?p_id", MySqlDbType.Int32)
'Sets parameter type equal to input
param.Direction = ParameterDirection.Input
'Sets parameter value equal to value held in textbox
param.Value = 4
'Creates parameter to pass into SPROC
param = cmdString.Parameters.Add("?p_image", MySqlDbType.VarChar)
'Sets parameter type to output
cmdString.Parameters("?p_image").Direction = ParameterDirection.Output
connection.Open() 'Opens DB connection
cmdString.ExecuteNonQuery() 'Executes procedure and reads in OUTPUT parameter
connection.Close() 'Closes DB connection
Catch ex As Exception
literr.Text = ex.Message
MsgBox(ex.Message)
End Try
MsgBox(cmdString.Parameters("?p_image").Value)
Dim imageStore As String = cmdString.Parameters("?p_image").Value
MsgBox(imageStore)
imgHolder.ImageUrl = ("c:\test\" & imageStore)
End Sub
<asp:image runat=server ID="imgHolder" Height="282px" Width="488px" BackColor="Red" />
</code>
|
|
|
|
|
boyindie wrote: when i check the html source file the tag has been filled with the valid address but it jus doesn't seem to want to render the image
You need to set teh ImageUrl to either a relative path from where the webpage is, or else a fully qualified web-address (http://www...etc). It can't just be any folder on your hard drive.
If your page is in the root folder of your website, adn the images in a subfo9lder called "images", you could set
imgHolder.ImageUrl = ("images/" & imageStore)
Your images folder (test) needs to be within your web application.
|
|
|
|
|
my connection code is:
String strConnection;
strConnection = "server=localhost;User ID=sa;Password=sas;database=db";
SqlConnection conn = new SqlConnection(strConnection);
conn.Open();
how will i write it in any application configuration file working in windows form,and call it on every page that needs to b connected??
can any body help me??
$h@ma!|@
|
|
|
|
|
i write in the folowing manner
<appsettings>
<add key="sqlserver" value="server=localhost;User
ID=sa;:Dassword=sa;database=db" ;="">
Sonia Gupta
Soniagupta1@yahoo.co.in
Yahoo messengerId-soniagupta1
Love is Friendship and Friendship is Love....
|
|
|
|
|
First and foremost, this is a VB.Net question (Not ASP.Net since you are using Win Forms) second in your app.config you need a < connectionStrings > < /connectionStrings > section (like below) then add your connection string as I have. The weird thing about your post is you ask how to make it work in the app.config in Windows Forms then you ask how to call it on every "page" taht needs it, Windows Forms dont have "pages". The below example will work in Windows Forms (which is what you asked).
As for the 2nd part of your question, the easiest way to call it is to write a function like below:
'This returns the connection string
Public Shared Function GetConnectionString(ByVal strConnection As String) As String
Dim strReturn As New String("")
'If you have multiple connection strings then you can pass it a connection name otherwise it defaults to your default connection
If Not String.IsNullOrEmpty(strConnection) Then
strReturn = ConfigurationManager.ConnectionStrings(strConnection).ConnectionString
Else
strReturn = ConfigurationManager.ConnectionStrings("MyConnectionName").ConnectionString
End If
Return strReturn
End Function
Then on the form that needs a DB connection call it like this:
Dim oConnection As New SqlConnection(YourClassName.GetConnectionString("MyConnectionName"))
<connectionstrings>
<add name="MyConnectionName">
connectionString="Persist Security Info=False;Data Source=localhost;Initial Catalog=db;Integrated Security=SSPI;Trusted_Connection=TRUE;Application Name=AppName"
providerName="System.Data.SqlClient" />
</add>
</connectionstrings>
If you mis-worded your question and need this for an ASP.Net application (not Windows Forms) reply and let me know and I'll help as much as I can
"Well yes, it is an Integer, but it's a metrosexual Integer. For all we know, under all that hair gel it could be a Boolean."
Tom Welch
|
|
|
|
|
in windows application i want to apply validation checks.i hv trued one for empty textbox
i.e.
if (textBox1.Text == "")
{
MessageBox.Show("Enter phone number", "Error in Input", MessageBoxButtons.OK, MessageBoxIcon.Information);
this.textBox1.Clear();
this.textBox1.Focus();
return;
}
how to validate numbers and alphabetic characters??
|
|
|
|
|
try ur code on key press event
if(e.keychar>=67 && e.keychar<=90)
{
e.handed=true;
}
Sonia Gupta
Soniagupta1@yahoo.co.in
Yahoo messengerId-soniagupta1
Love is Friendship and Friendship is Love....
|
|
|
|
|
it is giving error
'System.Windows.Forms.KeyPressEventArgs' does not contain a definition for 'keychar'
software student
|
|
|
|
|
this is the code.
private void keypress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar >= 67 && e.KeyChar <= 90)
{
e.Handled = true;
}
}
Sonia Gupta
Soniagupta1@yahoo.co.in
Yahoo messengerId-soniagupta1
Love is Friendship and Friendship is Love....
|
|
|
|
|
I made a page using CreateUserWizard but I restrict it for Admins only. The problem is when an Admin create an account for the new user, after completing the steps, it automatically change the logged in Admin to the new created account. Is there anyway not to login after creating an account? Except for the Security setup wizard on ASP.NET Configuration.
Thanks!
|
|
|
|
|
what code u r writing ?
Sonia Gupta
Soniagupta1@yahoo.co.in
Yahoo messengerId-soniagupta1
Love is Friendship and Friendship is Love....
|
|
|
|
|
I'm using Visual Studio 2005 and I'm writing ASP.Net pages. CreateUserWizard is very easy to use but I don't know how to change the settings so that after creating a new User, it will not automatically log-in on the user... Only Admins could create a new user.
|
|
|
|
|
Can you copy over the aspx code here?
<< >>
|
|
|
|
|
I want to do it for Drag & Drop & upload.
i want to drag a file from my desktop & drop on my web page.
Can i getimage path,image which i dropped.
it will be a dynamic file may be some image, text file or anything.
Thanx In Advance.
|
|
|
|
|
You'll need to embedd an activeX or .NET control into your page in order to offer this functionality, you can't do it otherwise.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|