Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I'm using request.querystring to get a value passed from a previous page. The value in question is a photoID number. From this I want to be able to get the phototname from the same table in the database. I've writtenthe query ("select photoname from photos where photoid = " & photoid & "") but I'm stuck when it comes to getting the photoname into a string variable. How do I do it?

 

I don't want to use a datagrid as the user doesn't need to know what's going on.

 

Hope I've explained it well enough and you lot can help me!

 

Thanks,

Mike

Posted

This is how I did it :

 

Dim cnn As SqlConnection = New SqlConnection(ConfigurationSettings.AppSettings("ConnString"))
           Dim cmd As SqlCommand = cnn.CreateCommand

cmd.CommandType = CommandType.Text

           cmd.CommandText = "SELECT  user_first, user_last, password,user_id  FROM user_m WHERE user_id = " & "'" & Replace(Trim(txtUserID.Text), "'", "''") & "'"
           cnn.Open()
           Dim dr As SqlDataReader = cmd.ExecuteReader

           If dr.Read() Then
               strFullName = dr.GetString(0) & " " & dr.GetString(1)
               strPassword = dr.GetString(2)
               strUserID = dr.GetString(3)
     end if

Posted

Thanks for your advice but I'm using MS Access and not mySQL.

Being a novice in ASP.NET, I'm led to believe this won't work as I can't use ".. new sql connection" and use oledbconnection and the MS Jet engine to connect.

 

Any ideas how it can be done using this set up?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...